this /static/media/twitter/W93DBJ.png

The workshop uses Python 3.7 or later, it'd be good if you could set it up before the workshop starts. If you know how, set up a virtualenv with pytest installed - if you don't, that's no problem, I'll cover it at the beginning of the workshop! The material will apply to both pytest 6.2 and 7.x.

This is the planned outline:

  • (30 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 / Live demos
  • (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)
    • Advanced fixture features: Caching, cleanup, implicit fixture use
    • Exercises / Live demos
  • (15 minutes): Running existing unittest suites with pytest:

    • Discussing advantages and limitations
    • Strategies for migrating to pytest
  • (60 minutes): Plugin ecosystem:

    • Examples of available plugins
    • Property-based testing (automated testcase generation) via Hypothesis
    • Overview of useful plugins
    • Writing custom plugins (quick overview)
    • Various live demos
  • (15 minutes): Open space for questions:

    • Leftover questions from the training
    • Other topics depending on interest
    • Buffer if we end up spending more time on something

Basic Python OOP knowledge (e.g. what a class/instance is) is required.

Note that the structure of the workshop is similar to the ones I've given at previous PyConDE 2019, but with updated material.

Florian Bruhin

Affiliation: Bruhin Software

Florian Bruhin ("The Compiler") is a long-time contributor and maintainer of both the pytest framework and various plugins. In 2013, he started the qutebrowser project, a keyboard-focused web browser based on Python and Qt. In 2015, he discovered pytest - since then, he has given talks and conducted workshops about pytest at various conferences and companies.

visit the speaker at: GithubHomepage