From e57d0e692b16bd5c5343c9b47ba55dd00b9897e9 Mon Sep 17 00:00:00 2001 From: Dan Cowell Date: Sat, 17 Oct 2026 15:26:35 +0900 Subject: [PATCH] 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 --- tests/unit/proxy/test_prisma_migration.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/proxy/test_prisma_migration.py b/tests/unit/proxy/test_prisma_migration.py index dfbe8aefbca..5fbaed7eb1b 100644 --- a/tests/unit/proxy/test_prisma_migration.py +++ b/tests/unit/proxy/test_prisma_migration.py @@ -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