Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Testing tools

Python has several libraries that help you writing and running automated tests. doctest and unittest come with python so they are part of the "standard libraries" of Python, but they are somewhat limited in their features.

pytest is a much feature-rich library with lots of extensions. In the recent years it became the de-facto standard for writing and running tests in Python.

In these examples we are going to see these 3 Python modules that can be used for testing.

  • doctest
  • unittest
  • pytest