You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tests/: split composite assertions and replace manual sys.path mutation with monkeypatch (SonarCloud S9073, S8997) #115
What is wrong. SonarCloud flags 30 sites in tests/, two rules:
python:S9073 "Split this composite assertion into separate assertions" (22
sites) — an assert a and b (or a and b, msg) hides which half failed, so a
red run in CI shows only AssertionError with no way to tell a from b
without opening the file:
python:S8997 "Use the monkeypatch fixture for temporary modifications
instead of manually modifying global state" (8 sites) — each is a bare sys.path.insert(0, str(REPO / "scripts")) inside a test function, with
nothing to undo it once the test returns, so the path entry leaks into every
test that runs afterward in the same process:
tests/test_family.py:183,207,243
tests/test_scaffold_e2e.py:688,716,814,841,897
What would fix it. For S9073, split each composite assert X and Y into
two separate assert X / assert Y statements, keeping a diagnostic message
on each half (duplicated or split as makes sense) so a failure still says
what broke — without changing what is actually asserted. For S8997, add the monkeypatch fixture parameter to each affected test function and replace
the manual sys.path.insert(0, ...) with monkeypatch.syspath_prepend(...),
which restores sys.path automatically at teardown instead of leaking it.
Out of scope: tests/test_naming_policy.py (owned by another lane in this
fan-out) and anything outside tests/.
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:22Z) CLAIMED — session 3b1ab8cf, on Brett Heap's word 'go, fan out on all of it'. Branch chore/tests-split-assertions-and-monkeypatch, worktree ~/projects/openRepoShape--tests-sonar-assertions on Eagle, from origin/main cd57c4b. Scope: split the 22 S9073 composite assertions and convert the 8 S8997 manual sys.path mutations to monkeypatch, across the 9 tests/ files SonarCloud named; tests/test_naming_policy.py excluded (owned by another lane).
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:38:58Z) MERGED — #116 → bbc6c86 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. tests/: the 22 SonarCloud S9073 composite assertions split into separate asserts with their messages kept, and the 8 S8997 manual sys.path mutations replaced by monkeypatch.syspath_prepend, across nine test files, nothing outside tests/; the now-unused import sys dropped in test_scaffold_e2e.py; Copilot 'Approval recommended' with 0 findings; suite 984 passed / 1 known machine-dependent flake / 1 skipped. Object complete.
Activity
brettheap commentedon Sep 11, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:22Z) CLAIMED — session 3b1ab8cf, on Brett Heap's word 'go, fan out on all of it'. Branch chore/tests-split-assertions-and-monkeypatch, worktree ~/projects/openRepoShape--tests-sonar-assertions on Eagle, from origin/main cd57c4b. Scope: split the 22 S9073 composite assertions and convert the 8 S8997 manual sys.path mutations to monkeypatch, across the 9 tests/ files SonarCloud named; tests/test_naming_policy.py excluded (owned by another lane).
brettheap commentedon Sep 11, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:2xZ) PULL REQUEST OPEN: #116 (head f18a65e).
tests/: a red composite assert names both halves, and a leaked sys.pa…
brettheap commentedon Sep 11, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-11T20:38:58Z) MERGED — #116 → bbc6c86 (squash), on Brett Heap's word 'go, fan out on all of it, hold the doctor refactor'. tests/: the 22 SonarCloud S9073 composite assertions split into separate asserts with their messages kept, and the 8 S8997 manual sys.path mutations replaced by monkeypatch.syspath_prepend, across nine test files, nothing outside tests/; the now-unused import sys dropped in test_scaffold_e2e.py; Copilot 'Approval recommended' with 0 findings; suite 984 passed / 1 known machine-dependent flake / 1 skipped. Object complete.