test: make sibling-worktree skip test hermetic (closes #283) #288

Merged
sysadmin merged 2 commits from fix/issue-283-hermetic-walk-root-test into master 2026-07-07 02:08:39 -05:00
Owner

Closes #283

What

tests/test_role_session_router.py::TestCheckMidMerge::test_skip_scan_walk_root_skips_sibling_worktrees_only failed on any clean checkout outside the branches/<slug> worktree layout (AssertionError: False is not true at the sibling-worktree skip assertion).

Root cause: the test derived main_root from __file__ (two directories above the repo root), but skip_python_scan_walk_root only skips a branches/ walk root when <project_root>/branches exists on disk. That directory only exists when the suite runs from a branch worktree whose orchestration checkout carries a real branches/ dir — so the test encoded the execution location, not the behavior.

Fix: build the <main>/branches/<worktree> layout in a tempfile.TemporaryDirectory() and assert against those paths. All four behavioral assertions preserved verbatim; production code untouched.

Validation

  • RED verified: test fails on clean master (d6f4f93) in a plain clone before the change.
  • GREEN: pytest tests/test_role_session_router.py — 12 passed.
  • Full suite: pytest tests/989 passed, 6 skipped, 0 failed (previously the only failure repo-wide).

Scope

One test method, test-only change, no runtime code.

🤖 Generated with Claude Code

Closes #283 ## What `tests/test_role_session_router.py::TestCheckMidMerge::test_skip_scan_walk_root_skips_sibling_worktrees_only` failed on any clean checkout outside the `branches/<slug>` worktree layout (`AssertionError: False is not true` at the sibling-worktree skip assertion). Root cause: the test derived `main_root` from `__file__` (two directories above the repo root), but `skip_python_scan_walk_root` only skips a `branches/` walk root when `<project_root>/branches` exists on disk. That directory only exists when the suite runs from a branch worktree whose orchestration checkout carries a real `branches/` dir — so the test encoded the execution location, not the behavior. Fix: build the `<main>/branches/<worktree>` layout in a `tempfile.TemporaryDirectory()` and assert against those paths. All four behavioral assertions preserved verbatim; production code untouched. ## Validation - RED verified: test fails on clean `master` (d6f4f93) in a plain clone before the change. - GREEN: `pytest tests/test_role_session_router.py` — 12 passed. - Full suite: `pytest tests/` — **989 passed, 6 skipped, 0 failed** (previously the only failure repo-wide). ## Scope One test method, test-only change, no runtime code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jcwalker3 added 1 commit 2026-07-06 23:23:03 -05:00
test_skip_scan_walk_root_skips_sibling_worktrees_only derived its
fixture paths from __file__, so the branches/ sibling-worktree skip
assertion only held when the suite ran from a branches/<slug> worktree
whose orchestration checkout has a real branches/ directory —
skip_python_scan_walk_root skips a branches/ walk root only when
<project_root>/branches exists on disk. From the main checkout or any
plain clone the test failed with 'AssertionError: False is not true'.

Build the <main>/branches/<worktree> layout in a TemporaryDirectory and
assert against those paths instead. All four behavioural assertions are
preserved and no production code changes.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
sysadmin added 1 commit 2026-07-07 01:01:13 -05:00
sysadmin approved these changes 2026-07-07 02:08:20 -05:00
sysadmin left a comment
Owner

PR #288 makes the sibling-worktree test hermetic using a TemporaryDirectory. This resolves location-dependent test failures on the master checkout. All targeted and full-suite test results are clean.

PR #288 makes the sibling-worktree test hermetic using a TemporaryDirectory. This resolves location-dependent test failures on the master checkout. All targeted and full-suite test results are clean.
sysadmin merged commit e4d78a5013 into master 2026-07-07 02:08:39 -05:00
Sign in to join this conversation.
No Reviewers
No labels
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#288