Python Testing Tips

Why most Python tests are a waste of time?

March 31, 2026

Most Python test suites have the same problem: they cost more trouble than they save. CI jobs that take forever, tests that break on every refactor, flaky pipelines you keep restarting. After years of writing (and deleting) tests, I've landed on 7 qualities that separate tests worth keeping from tests that just slow you down.

Mock HTTP Calls Effortlessly in Python with responses

Jan. 7, 2026

A utility for mocking Python's requests library in tests, helping avoid real network traffic during testing.

Time Travel in Your Tests with freezegun

Nov. 27, 2025

A library enabling developers to freeze time in tests for reliable validation of subscription status, trial eligibility, and date calculations.

How to mock different return values for each call of a method

Oct. 14, 2025

Techniques for handling scenarios where identical methods need distinct behaviors across multiple invocations.

How to customize assertion error message

Sept. 16, 2025

Methods for improving test failure clarity through custom error messaging.

Name parameterized pytest examples

April 3, 2025

Guidance on maintaining readability when using pytest parametrization with numerous examples.

create_autospec – easily ensure that mocked objects are called correctly

March 13, 2025

Using create_autospec to guarantee proper mock object usage in automated tests.

Parametrize tests using pytest

Feb. 5, 2025

Leveraging pytest parametrization to test multiple scenarios efficiently.

Testing behavior, not implementation details – part 3

April 10, 2024

Focuses on execution speed and parallel test strategies for comprehensive testing.

Testing behavior, not implementation details – part 2

March 27, 2024

Explores the concept of observable behavior in software testing.