release: 0.2.2 fix post-install packaging and robustness
This commit is contained in:
@@ -44,3 +44,33 @@ def test_list_directories_raises_for_missing_directory(tmp_path: Path) -> None:
|
||||
|
||||
with pytest.raises(FileNotFoundError):
|
||||
list_directories(missing_path)
|
||||
|
||||
|
||||
def test_list_directories_skips_permission_errors_for_children(tmp_path: Path) -> None:
|
||||
root = tmp_path / "root"
|
||||
root.mkdir()
|
||||
allowed = root / "allowed"
|
||||
blocked = root / "blocked"
|
||||
allowed.mkdir()
|
||||
blocked.mkdir()
|
||||
|
||||
blocked.chmod(0)
|
||||
try:
|
||||
entries = list_directories(root)
|
||||
finally:
|
||||
blocked.chmod(0o700)
|
||||
|
||||
assert any(entry.name == "allowed" for entry in entries)
|
||||
|
||||
|
||||
def test_has_subdirectories_returns_false_on_permission_error(tmp_path: Path) -> None:
|
||||
blocked = tmp_path / "blocked"
|
||||
blocked.mkdir()
|
||||
|
||||
blocked.chmod(0)
|
||||
try:
|
||||
result = has_subdirectories(blocked)
|
||||
finally:
|
||||
blocked.chmod(0o700)
|
||||
|
||||
assert result is False
|
||||
|
||||
Reference in New Issue
Block a user