Blog Posts by Date | tag: 'dataclasses'


Better parameterized pytests with dataclasses


September 14, 2023 / 23 min read / 5,566 views, 7 likes, 0 comments


pytest_dataclasses

Parameterization is a powerful tool in pytest (the most popular Python testing framework). It allows us to write a single, simple test that can dynamically expand to become many similar tests with minor input differences. In this blog post, I will describe how to write parameterized pytests and why they are such a powerful tool. And then, I'll show you how to re-write parameterized tests more effectively using dataclasses.

Read more...