diff --git a/tests/test_distributed_evidence.py b/tests/test_distributed_evidence.py index 6e459a9b..17a023e4 100644 --- a/tests/test_distributed_evidence.py +++ b/tests/test_distributed_evidence.py @@ -125,6 +125,9 @@ def test_evidence_parent_must_be_private_and_cannot_be_a_symlink(tmp_path): ) public = tmp_path / "public" public.mkdir(mode=0o755) + # mkdir's mode is filtered by the caller's umask; this fixture must be public. + public.chmod(0o755) + assert public.stat().st_mode & 0o777 == 0o755 with pytest.raises(ContractError, match="private"): write_evidence(public / "evidence.json", evidence) private = tmp_path / "private" diff --git a/tests/test_distributed_model_contracts.py b/tests/test_distributed_model_contracts.py index 18cdb3f8..c1b3ca73 100644 --- a/tests/test_distributed_model_contracts.py +++ b/tests/test_distributed_model_contracts.py @@ -343,6 +343,9 @@ def test_private_load_evidence_refuses_unsafe_destination(tmp_path, unsafe_sink) directory = tmp_path / "evidence" if unsafe_sink == "world_readable": directory.mkdir(mode=0o755) + # Exercise the unsafe mode even when the test runner uses umask 077. + directory.chmod(0o755) + assert directory.stat().st_mode & 0o777 == 0o755 else: target = tmp_path / "target" target.mkdir(mode=0o700)