I want to run pytest with coverage (pytest-cov) for my set of tests (stored in ./test) + doctests (stored in ./myproj/*.py) in a single command but I seem to be unable to get it to work
Running the unittests separately and appending the results from doctest works fine e.g.
pytest --cov=myproj --cov-report=html --cov-report=xml --cov-context=test
pytest --cov=myproj --cov-report=html --cov-report=xml --cov-append --doctest-modules
for CI this is fine bug for local testing it is rather annoying to have to type the second command every time.
Attempting to combine the two commands e.g.
pytest --cov=myproj --cov-report=html --cov-report=xml --cov-context=test --doctest-modules myproj
only runs the doctests.
Am I missing something obvious?
- Similar issue (lacking an answer): Run both doctests and normal tests with Pytest
- Similar issue (solution not working): How to make pytest run doctests as well as normal tests directory?