Testing

Everything here is about testing Python code – the frameworks available, the philosophies behind them, and practical advice for specific situations. Python has a strong culture around testing, and these pages reflect the community’s collected wisdom on the subject, from the standard library’s unittest and doctest modules to third-party tools like pytest.

Concepts and Approaches

  • Testing – a general overview of testing in Python and what it means to verify your code

  • Test-Driven Development – the TDD workflow: write the test first, then write the code

Frameworks and Tools

  • Unit Tests – survey of Python testing frameworks, including unittest and alternatives

  • pytest – the popular third-party test runner with minimal boilerplate

  • doctest – testing by embedding examples in docstrings

Specialized Topics