EuroPython 2016

pytest - simple, rapid and fun testing with Python

Speaker(s) Florian Bruhin

The py.test tool presents a rapid and simple way to write tests for your Python code. This training gives a quick introduction with exercises into some distinguishing features. We’ll do exercises where we get existing non-pytest test suites to run with pytest and discuss migration strategies. We’ll finish with discussing topics and questions of participants related to their own test suites and usages.

If you want to participate, please install pytest (e.g. in a virtualenv) before the training and download the code examples.

This is the planned outline:

  • (30 minutes) pytest feature walkthrough: automatic test discovery, assert statement, modular parametrizable fixtures, 150 plugins

  • (60 minutes) pytest fixture mechanism: dependency injection, declaring and using function/module/session scoped fixtures, using fixtures from fixture functions, parametrizing fixtures. Exercises.

  • (30 minutes): running nose/unittest/trial/Django suites with pytest. Discussing advantages and limitations. Exercise with a select existing real-life open source project.

  • (30 minutes): Strategies for a) migrating to pytest b) using “autouse” fixtures in conjunction with XUnit-based setup/tearodwn methods. Exercise.

  • (30 minutes): open space for questions and interactively solving pytest/unittest integration problems on real-life problems as time permits.

in on Friday 22 July at 10:15 See schedule


  1. Gravatar
    Hi there.

    Could you please tell me how different this training is gonna be wrt the one presented last year at EP2015?.
    At glance, the abstract looks exactly the same.
    — Valerio Maggio,
  2. Gravatar
    Hey Valerio,

    sorry for the late answer, seems I didn't get an email or anything...

    The training will be very similar to last year's indeed. It's aimed at people who couldn't be at last year's training for some reason. If you were there, I don't think you'll learn a lot of new things in this one.
    — Florian Bruhin,

New comment