Blog Posts by Date | tag: 'pytest'
September 14, 2023 / 23 min read / 545 , 1 , 0
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.
July 20, 2022 / 26 min read / 4,899 , 3 , 0
July 12, 2021 / 34 min read / 11,508 , 10 , 4
Are you a python developer looking to improve your testing abilities with pytest? Me too! So I've put together a list of 9 tips and tricks I've found most useful in getting my tests looking sharp. Here are the features we're going to be covering today:
- Useful command-line arguments
- Mocking with
fixtures and the
- Testing python exceptions
- Checking stdout and log messages
- Parameterizing tests
- Using pytest-cov