Page MenuHomeSoftware Heritage
Paste P1105

hg extid version test
ActivePublic

Authored by vlorentz on Jul 29 2021, 10:48 AM.
def test_load_new_extid_should_be_eventful(
swh_storage, datadir, tmp_path
):
"""Changing the extid version should make loaders ignore existing extids,
and load the repo again."""
archive_name = "hello"
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
repo_path = repo_url.replace("file://", "")
loader = HgLoaderFromDisk(swh_storage, repo_path)
with unittest.mock.patch("swh.loader.mercurial.from_disk.EXTID_VERSION", 0):
assert loader.load() == {"status": "eventful"}
assert loader.load() == {"status": "eventful"}
assert loader.load() == {"status": "uneventful"}
with unittest.mock.patch("swh.loader.mercurial.from_disk.EXTID_VERSION", 10000):
assert loader.load() == {"status": "eventful"}
assert loader.load() == {"status": "uneventful"}