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://", "") with unittest.mock.patch("swh.loader.mercurial.from_disk.EXTID_VERSION", 0): loader = HgLoaderFromDisk(swh_storage, repo_path) assert loader.load() == {"status": "eventful"} loader = HgLoaderFromDisk(swh_storage, repo_path) assert loader.load() == {"status": "eventful"} loader = HgLoaderFromDisk(swh_storage, repo_path) assert loader.load() == {"status": "uneventful"} with unittest.mock.patch("swh.loader.mercurial.from_disk.EXTID_VERSION", 10000): loader = HgLoaderFromDisk(swh_storage, repo_path) assert loader.load() == {"status": "eventful"} loader = HgLoaderFromDisk(swh_storage, repo_path) assert loader.load() == {"status": "uneventful"}