testsAndMisc/docs/superpowers/evidence/archwiki-reindex-path-independent-test-2026-08-23.json
Krzysztof kuhy Rudnicki ff3ea99a16 Fix a test that only passed in a directory named testsAndMisc
test_passes_store_and_repo_root asserted
env["PYTHONPATH"].endswith("testsAndMisc"), which is a property of the
checkout's directory name rather than of the code. It fails in any
worktree, which is where ci-mirror runs its gates.

Assert against the value reindex.py actually computes,
Path(reindex.__file__).resolve().parents[2]. Exact equality is a
stronger check than the suffix match it replaces.

This was invisible until now because ci-mirror invoked
pytest_changed_packages.py with no arguments, and that script returns 0
on empty argv -- so the pre-push pytest stage never ran. The next commit
fixes the invocation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
2026-08-23 14:53:29 +02:00

31 lines
1.4 KiB
JSON

{
"intent": "Make test_passes_store_and_repo_root pass in any checkout, not only one whose directory happens to be named 'testsAndMisc'.",
"scope": [
"python_pkg/archwiki_rag/tests/test_reindex.py",
"Non-goal: changing reindex.py production behaviour"
],
"changes": [
"Replaced the hardcoded assertion env['PYTHONPATH'].endswith('testsAndMisc') with an exact comparison against the repo root the code itself computes, Path(reindex.__file__).resolve().parents[2].",
"The assertion is strengthened, not weakened: exact equality replaces a suffix match."
],
"verification": [
{
"command": "python -m pytest python_pkg/archwiki_rag/tests/test_reindex.py -q",
"result": "pass",
"evidence": "19 passed, run both in /home/kuhy/testsAndMisc and in a worktree at /tmp/meas-gIJ1/co"
},
{
"command": "python meta/scripts/pytest_changed_packages.py <paths> in a clean worktree",
"result": "pass",
"evidence": "2101 passed, TOTAL coverage 100.00% (7082 stmts, 1742 branches, 0 missing)"
}
],
"risks": [
"None material: the test now asserts against the same expression the source uses, so a genuine PYTHONPATH regression still fails it."
],
"rollback": [
"git revert the commit",
"Re-run the archwiki_rag test module; it will pass again in ~/testsAndMisc but resume failing in any differently-named checkout"
]
}