fix: close consolidated quality review findings
tracker-policy-pr / check-pr (pull_request) Successful in 22s
lint / lint (push) Successful in 1m4s
test / unit (pull_request) Successful in 3m4s
test / image-input-builds (pull_request) Successful in 1m0s
test / integration-docker (pull_request) Successful in 1m10s
test / coverage (pull_request) Successful in 20s
prd-number-check / require-numbered-prds (pull_request) Failing after 10m52s

This commit is contained in:
2026-07-27 05:33:44 +00:00
parent 38a67d2767
commit aaf1e60abe
6 changed files with 61 additions and 24 deletions
+15 -1
View File
@@ -48,10 +48,24 @@ class TestDbStoreIsMigrated(unittest.TestCase):
with tempfile.TemporaryDirectory() as d:
parent = Path(d) / "store"
parent.mkdir()
with patch.object(Path, "chmod", side_effect=OSError("denied")):
(parent / "test.db").touch()
with patch("os.fchmod", side_effect=OSError("denied")):
with self.assertRaisesRegex(OSError, "denied"):
_store(parent)
def test_rejects_database_symlink_without_changing_target(self):
with tempfile.TemporaryDirectory() as d:
parent = Path(d) / "store"
parent.mkdir()
target = Path(d) / "target"
target.touch(mode=0o644)
(parent / "test.db").symlink_to(target)
with self.assertRaises(OSError):
_store(parent)
self.assertEqual(0o644, stat.S_IMODE(target.stat().st_mode))
def test_returns_false_when_schema_versions_missing(self):
# DB file exists but has no schema_versions table → OperationalError → False.
with tempfile.TemporaryDirectory() as d: