We will make a tour through the pytest core features and see how a lot of them are implemented using metaprogramming techniques like introspection/reflection, AST manipulation and other clever uses of Pythons Data and execution mod.

At the end of this talk we will have built a minimal re-implementation of what makes the core of pytest (code will be available in the pico-pytest repository).

To get to the essential ideas of their implementation, we will look at (wildly) simplified versions of:

  • test discovery and execution
  • object markers for test selection (@pytest.mark.<some custom name>)
  • automatic dependency injection (@pytest.fixture)
  • automatic test generation (@pytest.mark.parametrize)
  • test result introspection through assertion rewriting
  • offering extensibility through plugins

Oliver Bestwalter

Affiliation: Avira

Oliver fell in love with open source in the 1990s and with Python in 2006. He creates and helps maintain test and automation tools helping developers and companies to produce better software more effectively.

In 2016 he joined the tox project and is now one of the maintainers. Since 2017 he has been spending up to 20% of his time at Avira working on tox and other open source projects.

visit the speaker at: TwitterGithubHomepage