swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_one_visit0/loader.yml'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7fab143f65c0>
raw_sources = b'{\n "sources": [\n {\n "type": "url",\n "urls": [ "https://github.com/owner-1/repository-1/revision-1....Mcx6QctleltspAgXlM="\n }\n ],\n "version": "1",\n "revision": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7"\n}\n'
def test_loader_one_visit(swh_config, requests_mock_datadir, raw_sources):
loader = NixGuixLoader(sources_url)
res = loader.load()
assert res["status"] == "eventful"
stats = get_stats(loader.storage)
assert {
"content": 1,
"directory": 3,
"origin": 1,
"origin_visit": 1,
"person": 1,
"release": 0,
"revision": 1,
"skipped_content": 0,
"snapshot": 1,
} == stats
# The visit is partial because urls pointing to non tarball file
# are not handled yet
assert_last_visit_matches(
> loader.storage, sources_url, status="partial", type="nixguix"
)
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:247:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
storage = <swh.storage.retry.RetryingProxyStorage object at 0x7fab145b8eb8>
url = 'https://nix-community.github.io/nixpkgs-swh/sources.json'
status = 'partial', type = 'nixguix', snapshot = None
def assert_last_visit_matches(
storage,
url: str,
status: str,
type: Optional[str] = None,
snapshot: Optional[bytes] = None,
) -> OriginVisitStatus:
"""This retrieves the last visit and visit_status which are expected to exist.
This also checks that the {visit|visit_status} have their respective properties
correctly set.
This returns the last visit_status for that given origin.
Args:
url: Origin url
status: Check that the visit status has the given status
type: Check that the returned visit has the given type
snapshot: Check that the visit status points to the given snapshot
Raises:
AssertionError in case visit or visit status is not found, or any of the type,
status and snapshot mismatch
Returns:
the visit status for further check during the remaining part of the test.
"""
visit_and_status = origin_get_latest_visit_status(storage, url)
assert visit_and_status is not None, f"Origin {url} has no visits"
visit, visit_status = visit_and_status
if type:
assert visit.type == type, f"Visit has type {visit.type} instead of {type}"
> assert (
visit_status.status == status
), f"Visit_status has status {visit_status.status} instead of {status}"
E AssertionError: Visit_status has status full instead of partial
E assert 'full' == 'partial'
E - partial
E + full
.tox/py3/lib/python3.7/site-packages/swh/loader/tests/__init__.py:53: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Aug 7 2020, 6:44 PM