From 5caa064345d92334eb14ffd6edb7f9e01df8eb3d Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Thu, 5 Nov 2026 16:45:50 +0000 Subject: [PATCH] fix(tests): make the dockerignore lint follow the repository lints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tests/lint/repository/test_dockerignore.py from #1384 computes its own PROJECT_ROOT through parents[3] and reads files with Path.read_text, so test_project_root_import and test_no_uncached_file_reads fail on main (found by the store-i18n quality gate after its main merge). It now imports PROJECT_ROOT from the package and reads through utils.cache.files.read_text, like its neighbours; its three checks are unchanged. Both lints fail with main's version of the file and pass with this one; the test itself still passes. | 🎯 Fix | 💥 Break | 💸 Cost | ⏱️ Time | 🛡️ Security | 🏆 Score | Gate | | --- | --- | --- | --- | --- | --- | --- | | 95 % | 1 % | – | – | ~100 % | 94 | ⏳ score passes, gate.py not run (store-i18n gate holds the slot) | Co-Authored-By: Claude Opus 5.5 --- tests/lint/repository/test_dockerignore.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/lint/repository/test_dockerignore.py b/tests/lint/repository/test_dockerignore.py index 81df725641..c900866f99 100644 --- a/tests/lint/repository/test_dockerignore.py +++ b/tests/lint/repository/test_dockerignore.py @@ -1,27 +1,29 @@ import re import unittest -from pathlib import Path -PROJECT_ROOT = Path(__file__).resolve().parents[3] +from utils.cache.files import read_text + +from . import PROJECT_ROOT + NESTED_CHECKOUTS = (".claude/worktrees/", ".worktrees/") class TestDockerignore(unittest.TestCase): def test_dockerignore_is_the_gitignore(self) -> None: self.assertEqual( - (PROJECT_ROOT / ".gitignore").read_text(), - (PROJECT_ROOT / ".dockerignore").read_text(), + read_text(str(PROJECT_ROOT / ".gitignore")), + read_text(str(PROJECT_ROOT / ".dockerignore")), "Run 'make fix-dockerignore': .dockerignore must be a copy of .gitignore.", ) def test_nested_checkouts_stay_out_of_the_build_context(self) -> None: - lines = (PROJECT_ROOT / ".dockerignore").read_text().splitlines() + lines = read_text(str(PROJECT_ROOT / ".dockerignore")).splitlines() for entry in NESTED_CHECKOUTS: with self.subTest(entry=entry): self.assertIn(entry, lines) def test_compose_up_regenerates_the_dockerignore(self) -> None: - makefile = (PROJECT_ROOT / "Makefile").read_text() + makefile = read_text(str(PROJECT_ROOT / "Makefile")) match = re.search(r"^compose-up:(.*)$", makefile, re.MULTILINE) self.assertIsNotNone(match, "Makefile has no compose-up target") self.assertIn("fix-dockerignore", match.group(1).split())