Brussels / 1 & 2 February 2014


Introduction to py.test fixtures

py.test is a powerful and Pythonic unit testing tool which can scale from a few quick no-boilerplate tests to running huge unit and integration test suites.

One unique and powerful feature of py.test the dependency injection of test fixtures into the tests using function arguments. While the injection of fixtures via function arguments looks uncommon when used to the traditional JUnit setup and teardown mechanisms, py.test's fixtures are simple yet very flexible and arguably more powerful. This talk will walk through simple fixtures building up to show how to create more complicated setups by composing fixtures, controlling their scope and paremetrisation. This should lead to a good understanding of why fixtures are designed the way they are and why this is a very good and helpful mechanism to setup a test suite.


Floris Bruynooghe