Skip to content

fix test_named_agents by writing fake agent PATH to shell RC file#93

Open
trentdavies wants to merge 1 commit intoraine:mainfrom
trentdavies:fix/fake-agent-path
Open

fix test_named_agents by writing fake agent PATH to shell RC file#93
trentdavies wants to merge 1 commit intoraine:mainfrom
trentdavies:fix/fake-agent-path

Conversation

@trentdavies
Copy link
Copy Markdown

Fix test_named_agents failures

The two TestKnownAgentAutoDetection tests in test_named_agents.py fail on machines that have Claude Code installed because the real claude binary runs instead of the fake test script.

Root cause

New tmux panes start a fresh shell that sources .zshrc/.bashrc. The fake agent binary was only added to PATH via tmux set-environment -g and the subprocess environment, but new pane shells don't inherit from either — they get PATH from their shell profile.

The passing tests in test_agents.py already handle this correctly by writing the fake PATH into a shell RC file. test_named_agents.py was missing this step, so I implemented it so just test on Mac succeeds.

Fix

Added _write_rc_with_fake_path() helper that writes export PATH="<fake-bin-dir>:$PATH" to the shell RC file, so new tmux panes find the fake agent binary first. Matches the existing pattern in test_agents.py.

Test plan

  • pytest tests/test_workmux_add/test_named_agents.py — both tests pass
  • just test — 328/328 pass, 0 failures

New tmux panes start a fresh shell that sources .zshrc/.bashrc, so
fake agent binaries must be on PATH there — not just in the tmux
global environment. Matches the pattern used by test_agents.py.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant