Commit c0db9de
fix(tests): stop the suite reading ambient environment config
REPOGRAPH_BOUNDARY_ARTIFACT_FILE leaked from the caller's shell into every test.
Two that assert the "no artifact configured" path were contradicted by it:
test_reconcile.py::TestAC1SingleSourceOfTruth::test_no_artifact_no_scrub_targets
test_boundary_detectors.py::TestB2Required::test_b2_flags_missing_required_boundary_source
The exposure was two modules, not the one reported. Worth having checked: the
second lives in a file that already knows about the variable — it calls
monkeypatch.setenv at line 71 — and still had a test that inherited it.
Backwards in the way that matters. The variable is legitimately exported by
anyone who runs the audit locally or pushes through .hooks/pre-push, and is
absent in CI. So a developer with a WORKING setup saw a red suite while CI
stayed green — the failure mode that teaches people to ignore their own results.
Fixed with an autouse fixture in tests/conftest.py that clears the variable for
every test, rather than a delenv at the two call sites. The defect is that the
suite reads ambient config at all; patching the two known victims leaves the next
artifact-sensitive test to rediscover it. Tests that WANT the variable still set
it explicitly with monkeypatch.setenv, which is unaffected.
New tests/test_env_isolation.py pins the fixture — without it a later refactor
could drop the fixture and the only symptom would be a suite that passes in CI
and fails on the machines of the people most likely to run it. It asserts the
isolation list against boundary._ARTIFACT_FILE_ENV rather than a string literal,
so renaming the variable in the detector fails the test instead of silently
emptying the isolation. (First draft asserted only on os.environ and tripped our
own T8 — a test file importing nothing from any src package. Fair catch: it was
testing Python, not Custodian.)
Verified both directions: 1242 passed, 5 skipped with the variable set and with
it unset, identical. Audit clean apart from the pre-existing W2 (core.hooksPath
unset in this clone; CI sets it as the audit job's first step).
Pre-existing at origin/main — not caused by #72, which observed it and
deliberately left it alone to stay focused.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 1fd808e commit c0db9de
3 files changed
Lines changed: 124 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
5 | 41 | | |
6 | 42 | | |
7 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments