pytest_generate_tests
October 19, 2024
this and that
October 19, 2024
September 28, 2024
Fixtures in pytest are functions that provide a fixed baseline for tests, allowing resources (like database connections, input data, etc.) to be accessed and reused across multiple test cases. They can also handle setup and teardown for each test. Upon test initialization, fixtures are executed, and their results cached to be used and reused. The persistence of this cache depends on a specified “scope”. In this note, my intention is to jot down important concepts about fixtures and show some common ways in which they’re used.
September 21, 2024
Pytest markers are like tags. Tag your tests to keep them organized. Use markers to indicate test priority, or group them by performance, integration, or acceptance. Use them to skip tests under certain conditions, or mark them as expected failures. Use parametrization to run your test under different parameters.
September 21, 2024
A compilation of pro-tips. This page will be periodically updated.
August 26, 2024
Understanding these closely related methods can help us write better classes. The devs who use your code will thank you!
August 18, 2024
If you don’t already have a pyproject.toml
file for your existing project, you should. It is required to use with pip install .
and with poetry
. Let’s take a look at what a pyproject
file looks like.