Use autospeccing for your mocks in Python

Mocks are a powerful concept in testing. They are one of several types of test doubles, which are objects that can be used in place of real objects in your tests. Mocks are used to isolate the code under test from the rest of the system, and to verify that the code under test interacts with its dependencies correctly. However, if not used properly, mocks can lead to false positives in your tests. One common pitfall is that mocks can be too permissive, allowing you to call methods that don’t exist on the real object. This can lead to tests that pass even when the code under test is broken. ...

February 5, 2024

Supercharge Your Python TDD Workflow With pytest-watcher

If you follow the Test-driven Development practice in your Python projects, you need to run your test suite often. Having to run it manually can become tedious. You can configure handy shortcuts in your favorite IDE to make the process easier. But there is even better way using pytest-watcher. What is pytest-watcher? pytest-watcher is a continuous test runner for Python projects that reruns your tests whenever you change a *.py file inside your project. ...

June 8, 2023