Files
computer-playbook/tests/unit/python/roles/web-app-matrix/__init__.py
T
kevinveenbirkenbachandClaude Opus 5 98707e06f4 test(matrix): hold the CA passthrough guard to the repo's own conventions
The guard landed in 2acf91e18 breaking two rules it should have followed from
the start, and `make quality-high` caught both:

    test_ca_trust_passthrough.py:23: `parents[N]` index expression
    test_ca_trust_passthrough.py:23: `PROJECT_ROOT` assignment outside `__init__.py`
    test_ca_trust_passthrough.py:44: .read_text(...) uncached

So `PROJECT_ROOT` moves into the package `__init__.py`, where every other role
test suite keeps it, and both template reads go through `read_text` from
`utils.cache.files` so a second reader of the same file pays one open.

Verified with the flags the suite actually runs under. scripts/tests/code/run.sh
passes `--import-mode=importlib` and `consider_namespace_packages=true`, which
is what makes a hyphenated `roles/<role>/` directory importable at all; a plain
`pytest <path>` fails the relative import here and does so for the existing
sys-svc-mail-msmtp suite too, which is the control that says the pattern is
right and the invocation was wrong. Under those flags both suites pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 02:01:19 +02:00

4 lines
83 B
Python

from pathlib import Path
PROJECT_ROOT: Path = Path(__file__).resolve().parents[5]