test_scope_unreadable.py¶
tests/test_scope_unreadable.py
An unreadable directory in the tree is skipped, never fatal (#72 bug 1, 2.1).
test_an_unreadable_directory_is_skipped_by_the_nested_tree_walk
None test_scope_unreadable.test_an_unreadable_directory_is_skipped_by_the_nested_tree_walk(Path tmp_path)
No PermissionError; a real nested clone beside it is still found.
tests/test_scope_unreadable.py:25
Checks
assert root / "vendor" / "lib" in [Path(p) for p in found]
Result: passed
Verifies
| requirement | linked | path to the implementer |
|---|---|---|
| REQ-DDB-CONFIG-001 | measured | test_an_unreadable_directory_is_skipped_by_the_nested_tree_walk → nested_repo_roots |
Source · 19 lines
def test_an_unreadable_directory_is_skipped_by_the_nested_tree_walk(tmp_path: Path) -> None:
"""@brief No PermissionError; a real nested clone beside it is still found."""
root = tmp_path / "repo"
(root / ".git").mkdir(parents=True)
(root / "vendor" / "lib" / ".git").mkdir(parents=True)
locked = root / "logs" / "device"
locked.mkdir(parents=True)
(locked / "dump.txt").write_text("x")
os.chmod(locked, 0o644)
try:
found = scope.nested_repo_roots(root)
finally:
os.chmod(locked, 0o755)
assert root / "vendor" / "lib" in [Path(p) for p in found]
@pytest.mark.skipif(
os.geteuid() == 0, reason="root reads every directory, so nothing is unreadable"
)