Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ Authors
* Ofek Lev - https://github.com/ofek
* Art Pelling - https://github.com/artpelling
* Markéta Machová - https://github.com/MeggyCal
* xuu33030 - https://github.com/xuu33030
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
Changelog
=========

Unreleased
----------

* Document the import-path difference between ``coverage run -m pytest`` and ``pytest --cov`` for users migrating from coverage.py.
Contributed by xuu33030.

7.1.0 (2026-03-21)
------------------

Expand Down
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ This plugin provides coverage functionality as a pytest plugin. Compared to just
All features offered by the coverage package should work, either through pytest-cov's command line options or
through coverage's config file.

Migrating from coverage.py
--------------------------

``coverage run -m pytest`` and ``pytest --cov`` do not necessarily import code the same way. The former starts pytest with
``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.

For subprocess coverage, pytest-cov 7 no longer installs the ``.pth`` file used by earlier releases; see
`Upgrading from pytest-cov 6.3`_ below for the replacement.

* Free software: MIT license

Installation
Expand Down