self = <swh.loader.git.tests.test_loader.TestGitLoader2 object at 0x7f303d846e10>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f303a97e2e8>
def test_no_previous_snapshot(self, mocker):
statsd_report = mocker.patch("swh.core.statsd.statsd._report")
res = self.loader.load()
assert res == {"status": "eventful"}
self.fetcher_cls.assert_called_once_with(
credentials={},
lister_name="fake-lister",
lister_instance_name="",
origin=Origin(url=self.repo_url),
)
self.fetcher.get_parent_origins.assert_called_once_with()
# First tries the same origin
assert self.loader.storage.origin_visit_get_latest.mock_calls == [
call(
self.repo_url,
allowed_statuses=None,
require_snapshot=True,
type=None,
),
# As it does not already have a snapshot, fall back to the parent origin
call(
f"base://{self.repo_url}",
allowed_statuses=None,
require_snapshot=True,
type=None,
),
]
p = "swh.loader.git"
> assert [c for c in statsd_report.mock_calls if c.args[0].startswith(p)] == [
call(f"{p}.loader.incremental.no_previous_snapshot", "c", 1, None, 1),
call(
f"{p}.loader.ratio_ignored_refs",
"h",
0.0,
{"incremental": "no_previous_snapshot"},
1,
),
call(
f"{p}.loader.ratio_known_refs",
"h",
0.0,
{"incremental": "no_previous_snapshot"},
1,
),
]
E AssertionError: assert [] == [call('swh.lo...napshot'}, 1)]
E Right contains 3 more items, first extra item: call('swh.loader.git.loader.incremental.no_previous_snapshot', 'c', 1, None, 1)
E Full diff:
E [
E + ,
E - call('swh.loader.git.loader.incremental.no_previous_snapshot', 'c', 1, None, 1),
E - call('swh.loader.git.loader.ratio_ignored_refs', 'h', 0.0, {'incremental': 'no_previous_snapshot'}, 1),
E - call('swh.loader.git.loader.ratio_known_refs', 'h', 0.0, {'incremental': 'no_previous_snapshot'}, 1),...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
.tox/py3/lib/python3.7/site-packages/swh/loader/git/tests/test_loader.py:186: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 3 2022, 6:48 PM