Pytest is a powerful and popular testing library for Python. It is simple to get started, since in its most basic form, you can just write test functions.
Pytest also has the concept of fixtures, which is its unique selling point. Fixtures are functions which return data, and they can be dependency-injected into test functions before they run.
You'll see throughout this section how we use Pytest fixtures to enable us to test the FastAPI app, clear our "database" in between tests, and also write simple tests.
We will be writing a lot of fixtures in this course, so by the end you'll be very familiar with them!
In this section we'll first introduce Pytest, and then use it to write tests for everything in our API. Let's get started!