Repository navigation
docs: explain migration from coverage run to pytest-cov - #763
Merged
Merged
Conversation
ionelmc
force-pushed
the
docs/482-coverage-migration
branch
from
October 18, 2026 16:35
4aedf1f to
df4731b
Compare
webknjaz
reviewed
Oct 19, 2026
| ``python -m``, which adds the current working directory to ``sys.path``. The latter uses the ``pytest`` command, which does | ||
| not add it automatically. If coverage drops unexpectedly after switching, check that the package under test is installed | ||
| in your environment (for example, with ``pip install -e .``) rather than relying on the working directory being importable. | ||
| Run ``pytest --cov=myproj tests/`` from the same environment to confirm that tests still import your package. |
Member
There was a problem hiding this comment.
@ionelmc are you sure this is the best advice? I'd point people at source = . in .coveragerc.toml along with the source_pkgs pointing at the importable instead of calling --cov with a value..
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
coverage run -m pytesttopytest --covcan change imports and reported coverage.sys.path, and point to the existing subprocess migration note.Closes #482.
Verification
coverage run -m pytestreported CWD onsys.path, whereaspytest --covdid not (same test file, both passed).sphinx-build -b html -n -W docs <scratch-output>: passed before and after the change with no warnings.git diff --check: passed.This is a documentation-only change; the project's full tox matrix was not run. AI-assisted contribution; I reviewed the documentation, checked the behavior with an isolated reproducer, and ran the documentation build.