From 4a0fca2bcb2193455cdbef70006370d9116d05a1 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 14 Sep 2026 17:35:49 +0200 Subject: [PATCH] test(update): build the addon fixture from the role-file constants test_file_spot failed the gate on the pathlib chain that spelled meta/services.yml out by hand. Both paths now come from utils.roles.mapping as ROLE_FILE_META_SERVICES and ROLE_DIR_META_ADDONS, following ea37027f49 and 8243aa571b. All four chains move, not only the reported one. The lint reads the role-file shape and lets a "meta" / "addons" directory chain through, so leaving those behind would have split one fixture across two sources of truth, which is the split the lint exists to prevent. The constants are slash-bearing strings that Path accepts as a single segment, so the paths are unchanged. Only the throwaway role built under tempfile in TestCollectEntriesCoversAddons is affected; its assertions on entity_path and config_path.name are untouched. autoformat then reflowed the two write_text concatenations, which fit on one line once the names shortened, and the generator in test_oidc_setting_order.py. Co-Authored-By: Claude Opus 5 (1M context) --- .../test_oidc_setting_order.py | 4 +--- .../unit/python/utils/update/test_repository.py | 17 +++++++---------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/tests/unit/python/roles/web-app-discourse/test_oidc_setting_order.py b/tests/unit/python/roles/web-app-discourse/test_oidc_setting_order.py index e619fb2bb4..87ef01cba5 100644 --- a/tests/unit/python/roles/web-app-discourse/test_oidc_setting_order.py +++ b/tests/unit/python/roles/web-app-discourse/test_oidc_setting_order.py @@ -14,9 +14,7 @@ PREREQUISITES = ( def _line_of(lines: list[str], setting: str) -> int: return next( - index - for index, line in enumerate(lines) - if f"SiteSetting.{setting} = " in line + index for index, line in enumerate(lines) if f"SiteSetting.{setting} = " in line ) diff --git a/tests/unit/python/utils/update/test_repository.py b/tests/unit/python/utils/update/test_repository.py index b1d6ab0330..a956b4354e 100644 --- a/tests/unit/python/utils/update/test_repository.py +++ b/tests/unit/python/utils/update/test_repository.py @@ -5,6 +5,7 @@ import unittest from pathlib import Path from utils.cache.files import read_text +from utils.roles.mapping import ROLE_DIR_META_ADDONS, ROLE_FILE_META_SERVICES from utils.update.repository import ( RepositoryRefEntry, RepositoryRefUpdate, @@ -220,23 +221,19 @@ class TestApplyUpdates(unittest.TestCase): class TestCollectEntriesCoversAddons(unittest.TestCase): def _role(self, root: Path) -> Path: role = root / "roles" / "web-app-example" - (role / "meta" / "addons").mkdir(parents=True) + (role / ROLE_DIR_META_ADDONS).mkdir(parents=True) return role def test_addon_ref_is_collected_beside_the_service_ref(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: root = Path(tmpdir) role = self._role(root) - (role / "meta" / "services.yml").write_text( - "app:\n" - " repository: https://example.test/app.git\n" - " ref: v1.0.0\n", + (role / ROLE_FILE_META_SERVICES).write_text( + "app:\n repository: https://example.test/app.git\n ref: v1.0.0\n", encoding="utf-8", ) - (role / "meta" / "addons" / "plug.yml").write_text( - "config:\n" - " repository: https://example.test/plug.git\n" - " ref: v2.0.0\n", + (role / ROLE_DIR_META_ADDONS / "plug.yml").write_text( + "config:\n repository: https://example.test/plug.git\n ref: v2.0.0\n", encoding="utf-8", ) @@ -251,7 +248,7 @@ class TestCollectEntriesCoversAddons(unittest.TestCase): with tempfile.TemporaryDirectory() as tmpdir: root = Path(tmpdir) role = self._role(root) - (role / "meta" / "addons" / "plug.yml").write_text( + (role / ROLE_DIR_META_ADDONS / "plug.yml").write_text( "config:\n" " repository: https://example.test/plug.git\n" " # nocheck: repository-version\n"