diff --git a/swh/loader/svn/tests/test_loader.py b/swh/loader/svn/tests/test_loader.py --- a/swh/loader/svn/tests/test_loader.py +++ b/swh/loader/svn/tests/test_loader.py @@ -509,41 +509,46 @@ check_snapshot(expected_snapshot, loader.storage) -class SvnLoaderTest9(BaseSvnLoaderTest): +def test_loader_svn_visit_with_eol_style(swh_config, datadir, tmp_path): """Check that a svn repo containing a versioned file with CRLF line endings with svn:eol-style property set to 'native' (this is a violation of svn specification as the file should have been stored with LF line endings) can be loaded anyway. """ + archive_name = "mediawiki-repo-r407-eol-native-crlf" + archive_path = os.path.join(datadir, f"{archive_name}.tgz") + repo_initial_url = prepare_repository_from_archive( + archive_path, archive_name, tmp_path + ) - def setUp(self): - super().setUp( - archive_name="mediawiki-repo-r407-eol-native-crlf.tgz", - filename="mediawiki-repo-r407-eol-native-crlf", - ) - - def test_process_repository(self): - """Load repository with CRLF endings (svn:eol-style: native) is ok + # repo_initial_url becomes the origin_url we want to visit some more below + loader = SvnLoader(repo_initial_url) - """ - # when - assert self.loader.load() == {"status": "eventful"} + assert loader.load() == {"status": "eventful"} + expected_snapshot = { + "id": MEDIAWIKI_SNAPSHOT, + "branches": { + "HEAD": { + "target": "7da4975c363101b819756d33459f30a866d01b1b", + "target_type": "revision", + } + }, + } + check_snapshot(expected_snapshot, loader.storage) - expected_revisions = { - "7da4975c363101b819756d33459f30a866d01b1b": "f63637223ee0f7d4951ffd2d4d9547a4882c5d8b" # noqa - } - self.assertRevisionsContain(expected_revisions) - self.assertCountSnapshots(1) - self.assertEqual(self.loader.visit_status(), "full") + assert_last_visit_matches( + loader.storage, + repo_initial_url, + status="full", + type="svn", + snapshot=MEDIAWIKI_SNAPSHOT, + ) - assert_last_visit_matches( - self.storage, - self.repo_url, - status="full", - type="svn", - snapshot=MEDIAWIKI_SNAPSHOT, - ) + stats = get_stats(loader.storage) + assert stats["origin"] == 1 + assert stats["origin_visit"] == 1 + assert stats["snapshot"] == 1 class SvnLoaderTest10(BaseSvnLoaderTest): # noqa