pytest-cov : The pytest plugin for measuring coverage

Test & Code

pytest-cov is a pytest plugin that helps produce coverage reports using Coverage.py.

In this episode, we'll discuss:

  • what Coverage.py is
  • why you should measure code coverage on both your source and test code
  • what pytest-cov is
  • extra features pytest-cov gives you over and above coverage.py
  • and generally why using both is awesome

Links:

  • coverage.py
  • pytest-cov
  • how to set up context reports
  • Top pytest Plugins

Errata:

  • I mentioned that Coverage has the ability to show context (which line is covered by which test) for the past year or so.
    • However, that feature was released in Oct 2018. coverage 5.0 alpha 
    • That's over 6 years. Oops. Sorry Ned.

Help support the show AND learn pytest: 

  • The Complete pytest course is now a bundle, with each part available separately.
    • pytest Primary Power teaches the super powers of pytest that you need to learn to use pytest effectively.
    • Using pytest with Projects has lots of "when you need it" sections like debugging failed tests, mocking, testing strategy, and CI
    • Then pytest Booster Rockets can help with advanced parametrization and building plugins.
  • Whether you need to get started with pytest today, or want to power up your pytest skills, PythonTest has a course for you.
★ Support this podcast on Patreon ★

To listen to explicit episodes, sign in.

Stay up to date with this show

Sign in or sign up to follow shows, save episodes, and get the latest updates.

Select a country or region

Africa, Middle East, and India

Asia Pacific

Europe

Latin America and the Caribbean

The United States and Canada