Books

Books : reviews

Brian Okken.
Python Testing with pytest: simple, rapid, effective, and scalable.
Pragmatic Bookshel. 2017

rating : 3 : worth reading
review : 8 November 2024

Write expressive, elegant, and readable Python tests with pytest. The pytest testing framework helps you write tests quickly and keep them readable and maintainable—with no boilerplate code. Write small tests easily, and scale up to testing modules, packages, and applications with pytest’s robust fixture model.

Get up to speed quickly on this powerful tool with step-by-step instructions and sample code. Speed up test times by distributing tests across multiple processors. Test error conditions and corner cases with expected exception testing, and use one test to run many test cases with parameterized testing. Extend pytest with plugins, connect it to continuous integration systems, and use it in tandem with tox, mock, coverage, unittest, and doctest.

Write simple, maintainable tests that elegantly express what you’re testing and why.

This brings under one cover many aspect of pytest: how to write, name and run tests, testing packages, using fixtures for setup and tear down, writing parameterised tests, configuration files, using with other tools, and more. A useful initial guide and later reference.