In the previous chapters, we saw how to approach test-driven development, how to create a test suite with the unittest module, and how to organize it as it grows. While unittest is a very good tool and is a reliable solution for most projects, it lacks some convenient features that are available in more advanced testing frameworks.
PyTest is currently the most widespread testing framework in the Python community, and it's mostly compatible with unittest. So it's easy to migrate from unittest to pytest if you feel the need for the convenience that pytest provides.
In this chapter, we will cover the following topics:
- Running tests with PyTest
- Writing PyTest fixtures
- Managing temporary data with tmp_path
- Testing I/O with capsys
- Running subsets of the test suite