Skip to main content
Run any Skill in Manus
with one click

pytest-editable-install-resolves-to-primary-checkout-not-worktree

Stars2
Forks0
UpdatedJuly 8, 2026 at 11:09

When you run pytest (or any `python -c "import <pkg>"`) from a git WORKTREE but the venv has an editable install (`pip install -e .`) made from the PRIMARY checkout, `import <pkg>` silently resolves to the PRIMARY checkout's source, NOT the worktree code you think you're testing. Use when: (1) you edited code in a worktree, ran the suite, it passed/failed — but you're unsure it exercised the worktree's edits, (2) tests pass on changes that "shouldn't" pass (or fail on changes you reverted), (3) a `src/`-layout project with absolute `import src.*` / `import <pkg>.*` imports, one shared `.venv`, and multiple worktrees. Fix: prepend the worktree root to `PYTHONPATH` and VERIFY resolution with `print(<pkg>.__file__)`.

Installation

Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.

SKILL.md
readonly