Reusing test code

Reusing test code#

Learning Objectives#

After working through this topic, you should be able to:

  • employ pytest’s parametrize feature to use the same test function with different input parameters

  • write granular tests with little extra effort and without code duplication

  • remember where to look if you need to parametrize expected results, too

  • explain what fixtures are and how read up on

Materials#

Video:

Download the slides.

Check out the pytest documentation of parametrizations

Check out the pytest documentation of fixtures

Quiz#