Skip to content

fix: use absolute path for coverage.py executable - #756

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/pycoverage-executable-path
Open

fix: use absolute path for coverage.py executable#756
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/pycoverage-executable-path

Conversation

@sentry

@sentry sentry Bot commented Aug 8, 2026

Copy link
Copy Markdown

This PR addresses the FileNotFoundError: [Errno 2] No such file or directory: 'coverage' that occurs when the pycoverage plugin attempts to run coverage.py commands via subprocess.run.

The root cause was identified as a discrepancy between the PATH environment variable available to the main process (where shutil.which("coverage") successfully finds the executable) and the PATH inherited by the subprocesses spawned by subprocess.run. This can happen in various environments, particularly in CI/CD where virtual environments or shell configurations might not propagate correctly to subprocesses.

The fix involves capturing the absolute path of the coverage executable using shutil.which once at the beginning of the run_preparation method. This absolute path is then passed to and used by all subsequent subprocess.run calls within _generate_XML_report and _generate_JSON_report. This ensures that the exact, verified executable is invoked, regardless of the subprocess's inherited PATH.

Fixes CLI-8W

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.

0 participants