Conversation
cmdline.py inserts "" into sys.path with the comment that plugins may need to import from the current directory, but the insert sits below the erase and combine branches, both of which return before reaching it. Both commands construct Coverage, which loads configured plugins, so a plugin living in the project directory raises ModuleNotFoundError. The report in issue 1726 is about erase; combine is broken by the same defect, which matters more - it is the core of parallel mode. Only the console script is affected: python -m coverage puts the CWD on sys.path itself. Move the block above the action dispatch, keeping run excluded: there sys.path[0] is owned by PyRunner.prepare(), and run never reached the old line anyway, so its behaviour is unchanged.
|
Closes #1726. Repro on
Test: AI-assisted (LLM used for drafting the patch and the test); the analysis and the runs are mine. |
|
Ping — this has been open since 6 August with no review yet.
The fix moves the block above the action dispatch and keeps Branch is mergeable with no conflicts. Happy to close it if you would rather handle #1726 another way. |
|
This PR had no CI at all for its whole life, which I only noticed while auditing my open work. For the head commit It was specific to this PR, not the repository. Checking every open PR here: Every PR opened since Aug 2025 has 4–6 runs; the only other zeros are a handful from 2019–2025 whose last push predates the current workflows. I have merged current While I was there I re-verified the change against
The change itself is unchanged: move the 🤖 Generated with Claude Code |
Closes #1726.
cmdline.py inserts "" into sys.path with the comment that plugins may need to import from the current directory, but the insert sits below the erase and combine branches, both of which return before reaching it. Both commands construct Coverage, which loads configured plugins, so a plugin living in the project directory raises ModuleNotFoundError.
The report in issue 1726 is about erase; combine is broken by the same defect, which matters more - it is the core of parallel mode.
Only the console script is affected: python -m coverage puts the CWD on sys.path itself.
Move the block above the action dispatch, keeping run excluded: there sys.path[0] is owned by PyRunner.prepare(), and run never reached the old line anyway, so its behaviour is unchanged.