swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_loader_incremental0/loader.yml'
requests_mock_datadir = <requests_mock.mocker.Mocker object at 0x7f4436849c50>
def test_loader_incremental(swh_config, requests_mock_datadir):
"""Ensure a second visit do not download artifact already
downloaded by the previous visit.
"""
loader = NixGuixLoader(sources_url)
load_status = loader.load()
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)
urls = [
m.url
for m in requests_mock_datadir.request_history
if m.url == ("https://github.com/owner-1/repository-1/revision-1.tgz")
]
# The artifact
# 'https://github.com/owner-1/repository-1/revision-1.tgz' is only
# visited one time
> assert len(urls) == 1
E assert 2 == 1
E +2
E -1
.tox/py3/lib/python3.7/site-packages/swh/loader/package/nixguix/tests/test_nixguix.py:197: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Jun 22 2020, 4:49 PM