Standard Search
About 8 results
https://rednafi.com/python/inject-pytest-fixture/ · 2 Dec 2024
Clean up pytest test signatures using @pytest.mark.usefixtures to inject implicit fixtures without autouse or unused parameter warnings.
https://rednafi.com/python/pytest-param/ · 28 Aug 2024
Write readable parametrized tests with pytest.param for better test names, conditional skips, custom IDs, and structured test data.
https://rednafi.com/python/patch-pydantic-settings-in-pytest/ · 27 Jan 2024
Mock pydantic_settings in pytest tests by patching the settings class to prevent flaky tests from environment variable dependencies.
https://rednafi.com/python/compose-multiple-levels-of-pytest-fixtures/ · 21 Jul 2022
Combine session and function-scoped pytest fixtures to avoid expensive test setup while maintaining test isolation and preventing state coupling.
https://rednafi.com/python/patch-where-the-object-is-used/ · 18 Jul 2022
Master Python mocking: patch objects at their import location, not where they're defined, to avoid common unittest.mock pitfalls.
https://rednafi.com/python/mocking-datetime-objects/ · 16 Mar 2022
Mock chained datetime methods in Python tests using unittest.mock to handle immutable datetime objects without external dependencies.
https://rednafi.com/python/parametrized-fixtures-in-pytest/ · 10 Mar 2022
Create dynamic pytest fixtures with @pytest.fixture(params) to run tests with multiple configurations and parameter combinations.
https://rednafi.com/python/patch-with-pytest-fixture/ · 27 Feb 2022
Combine pytest fixtures with unittest.mock.patch for clean, reusable test mocking patterns that integrate seamlessly with pytest's ecosystem.