mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-29 14:30:52 +00:00
test(utils/inventory): read the rendered tools file through the file cache
PR #1663 run 43194423841 failed test-lint: tests/lint/filesystem/python/test_no_uncached_file_reads.py flagged test_tools_render.py:27, which read the rendered file with Path.read_text. It now reads it through utils.cache.files.read_text; the rendered path lives in a fresh tempdir per test, so the cache key is unique. Tests: test_tools_render and test_no_uncached_file_reads green. Negative control: the CI run on the old line. 🎯 Fix: 95 % 💥 Break: 1 % 💸 Cost: – ⏱️ Time: – 🛡️ Security: ~100 % 🏆 Score: 94 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3a7897dc6b
commit
f305ee024a
1 file changed
+2
-1
@@ -5,6 +5,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from utils.cache.files import read_text
|
||||
from utils.inventory import tools
|
||||
|
||||
MARKUP = "/models/<a & 'b'>\""
|
||||
@@ -24,7 +25,7 @@ class TestRender(unittest.TestCase):
|
||||
template.parent.mkdir(parents=True)
|
||||
template.write_text(TEMPLATE, encoding="utf-8")
|
||||
with patch.object(tools, "models_dir", return_value=MARKUP):
|
||||
rendered = tools.render(root, ["en", "de"]).read_text(encoding="utf-8")
|
||||
rendered = read_text(str(tools.render(root, ["en", "de"])))
|
||||
self.assertIn(f'models: "{MARKUP}"', rendered)
|
||||
self.assertIn("languages: de,en", rendered)
|
||||
self.assertIn(f"key: {tools.API_KEY}", rendered)
|
||||
|
||||
Reference in new issue
Block a user