Overview

I recently had to help some clients learn the basics of Pytest, and in order to do so I obviously had to learn Pytest first myself. This is just to capture some of the basics, some examples, and some recommendations and references acquired as part of the process.

Recommendations

If there’s one primary recommendation, it would be to buy and read Python Testing with pytest, Second Edition by Brian Okken.

For UK readers: hive.co.uk - Python Testing with pytest : Simple, Rapid, Effective, and Scalable.

I’ll include a number of other useful online resources, but the Python Testing with pytest book will save most people the time spent piecing together and digesting these into a single, well-paced learning experience.

Examples

References

The core docs for Pytest are very good but often a primer / how-to helps, the resources below have all helped clarify many of the aspects of Pytest.

Pytest Core Docs

Pytest Getting Started Guides

Pytest Beyond Basics

Pytest Corner Cases

Monkeypatch and Mocking