I’d like to run a coverage check with the following configuration:
coverage
is installed globally on the system (via pipx).pytest
in installed inside the virtual environment of the project.
(Inside the venv) When I run coverage run -m pytest
I get the error No module named 'pytest'
.
How to reproduce
pipx install coverage
python -m venv venv
source ./venv/bin/activate
pip install pytest
coverage run -m pytest
Here are some other outputs (inside the venv)
- command:
pytest --version
.- result: pytest 8.3.4
- command:
coverage run --source=. ./venv/bin/python -m pytest
- result:
- CoverageWarning: No data was collected.
- Couldn’t run ‘[…]/venv/bin/python’ as Python code: SyntaxError: invalid or missing encoding declaration
- result:
2