swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_two_visits0/loader.yml'
requests_mock_datadir_visits = <requests_mock.mocker.Mocker object at 0x7fab145bc6a0>
def test_loader_two_visits(swh_config, requests_mock_datadir_visits):
"""To ensure there is only one origin, but two visits, two revisions
and two snapshots are created.
The first visit creates a snapshot containing one tarball. The
second visit creates a snapshot containing the same tarball and
another tarball.
"""
loader = NixGuixLoader(sources_url)
load_status = loader.load()
assert load_status == {"status": "eventful", "snapshot_id": SNAPSHOT1.id.hex()}
assert_last_visit_matches(
loader.storage,
sources_url,
status="partial",
type="nixguix",
> snapshot=SNAPSHOT1.id,
)
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
storage = <swh.storage.retry.RetryingProxyStorage object at 0x7fab14420c50>
url = 'https://nix-community.github.io/nixpkgs-swh/sources.json'
status = 'partial', type = 'nixguix'
snapshot = b'\x0cX\x81\xc7B\x83y>\xbe\x9a\t\xa1\x05\xa98\x1eA8\x03\x83'
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