Skip to content

Instantly share code, notes, and snippets.

@floer32
Last active August 21, 2017 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floer32/1aeb36ee85f4bdce0899 to your computer and use it in GitHub Desktop.
Save floer32/1aeb36ee85f4bdce0899 to your computer and use it in GitHub Desktop.
Run pytest with doctests and coverage from doctests AND normal unittests/pytests
# A coworker of mine covinced himself that the built-in pytest doctest support module didn't integrate with pytest-cov.
# He wrote his shim to get around this. Not necessary though.
# The gist is to make sure you have "--doctest-modules" and "--cov-report" and "--cov" arguments.
py.test . --doctest-modules --cov-report term --cov=.
# or
py.test mymodule --doctest-modules --cov-report term --cov=mymodule
@floer32
Copy link
Author

floer32 commented Dec 16, 2015

A coworker of mine covinced himself that the built-in pytest doctest support module didn't integrate with pytest-cov.
He wrote a shim to get around this, but actually that's not necessary...

The gist is to make sure you have "--doctest-modules" and "--cov-report" and "--cov" arguments.

@floer32
Copy link
Author

floer32 commented Dec 16, 2015

ticket to dummy-proof the docs in this regard: pytest-dev/pytest-cov#101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment