Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9343573
D6632.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Subscribers
None
D6632.diff
View Options
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
@@ -204,7 +204,7 @@
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
visit_status1 = assert_last_visit_matches(
@@ -237,7 +237,7 @@
)[0]
assert start_revision is not None
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "uneventful"}
stats = get_stats(loader.storage)
@@ -275,7 +275,7 @@
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
check_snapshot(GOURMET_SNAPSHOT, loader.storage)
@@ -292,7 +292,9 @@
archive_path2, archive_name, tmp_path
)
- loader2 = SvnLoader(swh_storage, repo_tampered_url, origin_url=repo_url)
+ loader2 = SvnLoader(
+ swh_storage, repo_tampered_url, origin_url=repo_url, temp_directory=tmp_path
+ )
assert loader2.load() == {"status": "eventful"}
assert_last_visit_matches(
@@ -322,7 +324,7 @@
)
# repo_initial_url becomes the origin_url we want to visit some more below
- loader = SvnLoader(swh_storage, repo_initial_url)
+ loader = SvnLoader(swh_storage, repo_initial_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
visit_status1 = assert_last_visit_matches(
@@ -338,7 +340,12 @@
archive_path, "pkg-gourmet", tmp_path
)
- loader = SvnLoader(swh_storage, repo_updated_url, origin_url=repo_initial_url,)
+ loader = SvnLoader(
+ swh_storage,
+ repo_updated_url,
+ origin_url=repo_initial_url,
+ temp_directory=tmp_path,
+ )
assert loader.load() == {"status": "eventful"}
visit_status2 = assert_last_visit_matches(
@@ -368,7 +375,11 @@
# Let's start the ingestion from the start, this should yield the same result
loader = SvnLoader(
- swh_storage, repo_updated_url, origin_url=repo_initial_url, incremental=False,
+ swh_storage,
+ repo_updated_url,
+ origin_url=repo_initial_url,
+ incremental=False,
+ temp_directory=tmp_path,
)
assert loader.load() == {"status": "eventful"}
visit_status3 = assert_last_visit_matches(
@@ -400,7 +411,7 @@
)
# repo_initial_url becomes the origin_url we want to visit some more below
- loader = SvnLoader(swh_storage, repo_initial_url)
+ loader = SvnLoader(swh_storage, repo_initial_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
visit_status1 = assert_last_visit_matches(
@@ -422,7 +433,12 @@
)
# we'll start from start_revision
- loader = SvnLoader(swh_storage, repo_updated_url, origin_url=repo_initial_url,)
+ loader = SvnLoader(
+ swh_storage,
+ repo_updated_url,
+ origin_url=repo_initial_url,
+ temp_directory=tmp_path,
+ )
assert loader.load() == {"status": "eventful"}
@@ -464,7 +480,7 @@
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
mediawiki_snapshot = Snapshot(
@@ -504,7 +520,7 @@
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
pyang_snapshot = Snapshot(
@@ -536,7 +552,7 @@
archive_path = os.path.join(datadir, "pkg-gourmet-with-external-id.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
gourmet_externals_snapshot = Snapshot(
@@ -582,7 +598,7 @@
)
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
gourmet_edge_cases_snapshot = Snapshot(
@@ -623,7 +639,7 @@
archive_path = os.path.join(datadir, "pkg-gourmet-with-wrong-link-cases.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loader = SvnLoader(swh_storage, repo_url)
+ loader = SvnLoader(swh_storage, repo_url, temp_directory=tmp_path)
assert loader.load() == {"status": "eventful"}
gourmet_wrong_links_snapshot = Snapshot(
@@ -664,7 +680,9 @@
archive_path = os.path.join(datadir, f"{archive_name}.tgz")
repo_url = prepare_repository_from_archive(archive_path, archive_name, tmp_path)
- loaderFromDump = SvnLoaderFromRemoteDump(swh_storage, repo_url)
+ loaderFromDump = SvnLoaderFromRemoteDump(
+ swh_storage, repo_url, temp_directory=tmp_path
+ )
assert loaderFromDump.load() == {"status": "eventful"}
assert_last_visit_matches(
loaderFromDump.storage,
@@ -675,7 +693,9 @@
)
origin_url = repo_url + "2" # rename to another origin
- loader = SvnLoader(swh_storage, repo_url, origin_url=origin_url)
+ loader = SvnLoader(
+ swh_storage, repo_url, origin_url=origin_url, temp_directory=tmp_path
+ )
assert loader.load() == {"status": "eventful"} # because are working on new origin
assert_last_visit_matches(
loader.storage,
@@ -692,7 +712,9 @@
assert stats["origin_visit"] == 2
assert stats["snapshot"] == 1
- loader = SvnLoader(swh_storage, repo_url) # no change on the origin-url
+ loader = SvnLoader(
+ swh_storage, repo_url, temp_directory=tmp_path
+ ) # no change on the origin-url
assert loader.load() == {"status": "uneventful"}
assert_last_visit_matches(
loader.storage,
@@ -708,7 +730,9 @@
assert stats["snapshot"] == 1
# second visit from the dump should be uneventful
- loaderFromDump = SvnLoaderFromRemoteDump(swh_storage, repo_url)
+ loaderFromDump = SvnLoaderFromRemoteDump(
+ swh_storage, repo_url, temp_directory=tmp_path
+ )
assert loaderFromDump.load() == {"status": "uneventful"}
diff --git a/swh/loader/svn/tests/test_utils.py b/swh/loader/svn/tests/test_utils.py
--- a/swh/loader/svn/tests/test_utils.py
+++ b/swh/loader/svn/tests/test_utils.py
@@ -51,7 +51,7 @@
dump_path = os.path.join(datadir, dump_name)
tmp_repo, repo_path = utils.init_svn_repo_from_dump(
- dump_path, gzip=True, cleanup_dump=False
+ dump_path, gzip=True, cleanup_dump=False, root_dir=tmp_path
)
assert os.path.exists(dump_path), "Dump path should still exists"
@@ -69,7 +69,9 @@
assert os.path.exists(dump_path)
assert os.path.exists(dump_ori_path)
- tmp_repo, repo_path = utils.init_svn_repo_from_dump(dump_path, gzip=True)
+ tmp_repo, repo_path = utils.init_svn_repo_from_dump(
+ dump_path, gzip=True, root_dir=tmp_path
+ )
assert not os.path.exists(dump_path), "Dump path should no longer exists"
assert os.path.exists(repo_path), "Repository should exists"
@@ -94,7 +96,9 @@
assert os.path.exists(dump_path)
assert os.path.exists(dump_ori_path)
- tmp_repo, repo_path = utils.init_svn_repo_from_dump(dump_path, gzip=True)
+ tmp_repo, repo_path = utils.init_svn_repo_from_dump(
+ dump_path, gzip=True, root_dir=tmp_path
+ )
assert os.path.exists(repo_path), "Repository should exists"
assert os.path.exists(dump_ori_path), "Original dump path should still exists"
@@ -110,7 +114,7 @@
dump_path = os.path.join(datadir, dump_name)
tmp_repo, repo_path = utils.init_svn_repo_from_archive_dump(
- dump_path, cleanup_dump=False
+ dump_path, cleanup_dump=False, root_dir=tmp_path
)
assert os.path.exists(dump_path), "Dump path should still exists"
@@ -128,7 +132,9 @@
assert os.path.exists(dump_path)
assert os.path.exists(dump_ori_path)
- tmp_repo, repo_path = utils.init_svn_repo_from_archive_dump(dump_path)
+ tmp_repo, repo_path = utils.init_svn_repo_from_archive_dump(
+ dump_path, root_dir=tmp_path
+ )
assert not os.path.exists(dump_path), "Dump path should no longer exists"
assert os.path.exists(repo_path), "Repository should exists"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 1:39 PM (5 d, 3 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3225485
Attached To
D6632: test: Make sure loader runs use tmp_path fixture
Event Timeline
Log In to Comment