Learning Path

Unit Testing and TDD with PyTest

Instructor Santosh Shetty
Time to complete: 12m

Published byPackt Publishing

CreatedJune 2018

Learn the application of Unit Testing and TDD using the PyTest unit testing framework

In Detail

In this course you will get to know some best practices for Unit Testing and TDD. You will walk through some examples of the best practices in action. Learn more about the different types of code coverage and the PyTest.cov code coverage tool. Also go through a simple hands on example of using PyTest.cov to generate a code coverage report.

What will you learn:

  • Learn about running tests in random order and the benefits of using a static code analysis tool like Pylint
  • Use pytest-random-order and pytest-repeat to ensure our tests really are independent and pass every time
  • Learn about the different types of code coverage
  • Generate a PyTest.cov code coverage report with some gaps in the coverage


  • Good knowledge of Python programming (version 2.7 or 3) is expected.

Resources: Code downloads and errata:

  • Unit Testing and TDD with PyTest(No code file for this SVLP)