swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_two_visits0/loader.yml'
requests_mock_datadir_visits = <requests_mock.mocker.Mocker object at 0x7f4435ea5400>
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()
expected_snapshot_id = "0c5881c74283793ebe9a09a105a9381e41380383"
assert load_status == {"status": "eventful", "snapshot_id": expected_snapshot_id}
assert_last_visit_matches(
loader.storage, sources_url, status="partial", type="nixguix"
)
expected_branches = {
"evaluation": {
"target": "cc4e04c26672dd74e5fd0fecb78b435fb55368f7",
"target_type": "revision",
},
"https://github.com/owner-1/repository-1/revision-1.tgz": {
"target": "488ad4e7b8e2511258725063cf43a2b897c503b4",
"target_type": "revision",
},
}
expected_snapshot = {
"id": expected_snapshot_id,
"branches": expected_branches,
}
snapshot = check_snapshot(expected_snapshot, storage=loader.storage)
check_snapshot_revisions_ok(snapshot, loader.storage)
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
loader = NixGuixLoader(sources_url)
load_status = loader.load()
expected_snapshot_id = "b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97"
> assert load_status == {"status": "eventful", "snapshot_id": expected_snapshot_id}
E AssertionError: assert {'snapshot_id...': 'eventful'} == {'snapshot_id...': 'eventful'}
E Omitting 1 identical items, use -vv to show
E Differing items:
E {'snapshot_id': '06b11519f6cbc59884ba31d3e4da112f27a4d9bd'} != {'snapshot_id': 'b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97'}
E Full diff:
E {
E - 'snapshot_id': 'b0bfa75cbd0cc90aac3b9e95fb0f59c731176d97',
E + 'snapshot_id': '06b11519f6cbc59884ba31d3e4da112f27a4d9bd',...
E
E ...Full output truncated (3 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:252: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 22 2020, 4:49 PM