Summary

Completed

In this module, we went through a few advanced features of the Pytest framework. First, we started with parametrize, a useful Python decorator that can inject inputs for a single test while treating them as individual tests. Then we covered fixtures, which are reusable test helpers that can clean up automatically.

Finally, you tried writing tests with parametrize and ported a test class to use a custom fixture for temporary files.

With these Pytest features, you should be able to improve tests by using parametrize and create robust test helpers with fixtures. Extending a test suite with these features or updating an existing test suite allows the following:

  • Makes tests easier to read
  • Reduces test code with reusable helpers
  • Creates granular tests, which improve error reports
  • Robust setup and cleanups that happen automatically