test(proxy): cover the default writability check against the real filesystem

The other tests inject the writability check, so the default one that calls
os.access was never run. Check it against a real temp directory and a
missing one, which holds even when the tests run as root
This commit is contained in:
Dan Cowell 2026-10-17 15:26:35 +09:00
parent e6bbf52aa6
commit e57d0e692b

View file

@ -119,3 +119,14 @@ class TestPrismaMigration:
prisma_migration.prisma_package_is_writable(find_spec=lambda _name: None, is_writable=lambda _path: True)
is False
)
def test_prisma_package_is_writable_checks_the_real_filesystem_by_default(self, tmp_path: Path) -> None:
missing_dir: Path = tmp_path / "missing"
def spec_at(location: Path) -> ModuleSpec:
spec = ModuleSpec("prisma", None, is_package=True)
spec.submodule_search_locations = [str(location)]
return spec
assert prisma_migration.prisma_package_is_writable(find_spec=lambda _name: spec_at(tmp_path)) is True
assert prisma_migration.prisma_package_is_writable(find_spec=lambda _name: spec_at(missing_dir)) is False