mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 20:07:04 +01:00
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
This commit is contained in:
parent
325d5a8baa
commit
ff3ea99a16
@ -0,0 +1,30 @@
|
||||
{
|
||||
"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"
|
||||
]
|
||||
}
|
||||
@ -143,7 +143,8 @@ class TestRunReindex:
|
||||
|
||||
env = mock_run.call_args.kwargs["env"]
|
||||
assert env["KNOWLEDGE_RAG_DIR"] == "/store"
|
||||
assert env["PYTHONPATH"].endswith("testsAndMisc")
|
||||
expected_root = Path(reindex.__file__).resolve().parents[2]
|
||||
assert env["PYTHONPATH"] == str(expected_root)
|
||||
|
||||
@patch(f"{MOD}.subprocess.run")
|
||||
def test_prepends_to_existing_pythonpath(self, mock_run: MagicMock) -> None:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user