Using pytest, you can write tests in a rapid and simple way. This training gives an introduction with exercises to many of its features. We’ll also explore how to migrate to pytest and see how it can run existing tests. Various plugins which extend pytest’s functionality even further will be shown.
The pytest tool presents a rapid and simple way to write tests for your Python code. This training gives an introduction with exercises to some distinguishing features. We’ll also examine how to run existing non-pytest test suites and discuss migration strategies. Various plugins which extend pytest’s functionality even further will be introduced. We’ll finish with discussing topics and questions of participants related to their own test suites and usages.
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!
Rough planned outline:
(15 minutes) Setup and overview
(30 minutes) pytest feature walkthrough:
(60 minutes) pytest fixture mechanism:
(30 minutes): Running existing unittest suites with pytest:
(30 minutes): Useful third-party plugins:
(15 minutes): Mocking overview:
(30 minutes): Writing custom plugins overview:
(30 minutes): Open space for questions:
Basic Python OOP knowledge (e.g. what a class/instance is) is required.