pytest - simple, rapid and fun testing with Python

Florian Bruhin

Thursday 16:15 in Ferrum
  • (20 minutes) pytest feature walkthrough:

    • Automatic test discovery
    • Assertions without boilerplate via the assert statement
    • Configuration and commandline options
    • Marking and skipping tests
    • Data-driven tests via parametrization
    • Exercises
  • (60 minutes) pytest fixture mechanism:

    • Setup and teardown via dependency injection
    • Declaring and using function/module/session scoped fixtures
    • Using fixtures from fixture functions
    • Parametrizing fixtures
    • Looking at useful built-in fixtures (managing temporary files, patching, output capturing)
    • Exercises
  • (10 minutes) Where to go next:

    • Useful CLI arguments to deal with failing tests
    • Overview of the plugin ecosystem around pytest

Florian Bruhin