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) <noreply@anthropic.com>
This commit is contained in:
kevinveenbirkenbachandClaude Opus 5 committed 2026-09-14 17:35:49 +02:00
1 parent ea46bf5fde
commit 4a0fca2bcb
2 files changed
+8 -13

No files matched your search

@@ -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
)
@@ -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"