Currently neither pytest --cov nor coverage run -m pytest come without drawbacks:
pytest --cov only starts collecting coverage after plugins have been loaded, so it doesn’t correctly collect coverage in some situations. coverage run is just more reliable.
Currently neither
pytest --cov
norcoverage run -m pytest
come without drawbacks:pytest --cov
only starts collecting coverage after plugins have been loaded, so it doesn’t correctly collect coverage in some situations.coverage run
is just more reliable.covtest run
doesn’t have pytest’s behavior of not adding the working directory tosys.path
and can’t be made to do that: https://github.com/nedbat/coveragepy/issues/1696I think due to our use of the
src
layout, the latter is the better tradeoff