pytest: Expand test inputs using dynamic fixtures

When writing tests in Python, I always choose the pytest test framework. It is concise, feature-rich has a great ecosystem of plugins, is widely used, and supported in the community. One aspect which makes it blend seamlessly with the code under test is how test input can be passed to it. Within this part of the usual arrange-act-assert structure of tests, let’s explore one particular feature: parametrization. Accompanying example Before we dive into pytest, let’s build a concrete example to eventually write tests for....

June 30, 2020 · 7 min · Carsten Rösnick-Neugebauer