Chapter 4Builtin Fixtures
In the previous chapter, you learned what fixtures are, how to write them, and how to use them for test data as well as setup and teardown code. You also used conftest.py for sharing fixtures between tests in multiple test files.
Reusing common fixtures is such a good idea that the pytest developers included some commonly used fixtures with pytest. The builtin fixtures that come prepackaged with pytest can help you do some pretty useful things in your tests easily and consistently. For example, pytest includes builtin fixtures that can handle temporary directories and files, access command-line options, communicate between test sessions, validate output streams, modify environment variables, and interrogate warnings. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access