Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9337286
D8031.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D8031.diff
View Options
diff --git a/swh/vault/tests/test_to_disk.py b/swh/vault/tests/test_to_disk.py
--- a/swh/vault/tests/test_to_disk.py
+++ b/swh/vault/tests/test_to_disk.py
@@ -79,7 +79,7 @@
list(get_filtered_files_content(swh_storage, files_data))
-def _fill_storage(swh_storage, exclude_cnt3=False):
+def _fill_storage(swh_storage, exclude_cnt3=False, exclude_dir1=False):
cnt1 = Content.from_data(b"foo bar")
cnt2 = Content.from_data(b"bar baz")
cnt3 = Content.from_data(b"baz qux")
@@ -119,7 +119,10 @@
swh_storage.content_add([cnt1, cnt2])
else:
swh_storage.content_add([cnt1, cnt2, cnt3])
- swh_storage.directory_add([dir1, dir2])
+ if exclude_dir1:
+ swh_storage.directory_add([dir2])
+ else:
+ swh_storage.directory_add([dir1, dir2])
return dir2
@@ -160,3 +163,22 @@
assert root.is_dir()
assert "This content is missing" in (root / "content3").open().read()
+
+
+def test_directory_builder_missing_directory(swh_storage, tmp_path):
+ dir2 = _fill_storage(swh_storage, exclude_dir1=True)
+
+ root = tmp_path / "root"
+ builder = DirectoryBuilder(swh_storage, bytes(root), dir2.id)
+
+ assert not root.exists()
+
+ builder.build()
+
+ assert root.is_dir()
+ assert set(root.glob("**/*")) == {
+ root / "subdirectory",
+ root / "content3",
+ }
+
+ assert (root / "content3").open().read() == "baz qux"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jul 3 2025, 7:59 AM (10 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3220136
Attached To
D8031: Add test for DirectoryBuilder on missing directories
Event Timeline
Log In to Comment