Dynamic and Parametric Tests and Fixtures

In the previous chapter, we saw how pytest can be used to run our test suites, and how it provides some more advanced features that are unavailable in unittest by default. Python has seen multiple frameworks and libraries built on top of unittest to extend it with various features and utilities, but pytest has surely become the most widespread testing framework in the Python community. One of the reasons why pytest became so popular is its flexibility and support for dynamic behaviors. Apart from this, generating tests and fixtures dynamically or heavily changing test suite behavior are other features supported by pytest out of the box.

In this chapter, we are going to see how to configure a test ...

Get Crafting Test-Driven Software with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.