Using Pytest

Learn how to use pytest.

Getting started

Pytest is an excellent alternative to the built-in unittest library. It automatically finds our tests and runs them. It makes it easy to do the setup for the tests and break them down afterward, which is important since we have to make it work with Flask applications.

To get started, install pytest using pipenv.

$ pipenv install --dev pytest

Note: It’s already installed here.

Within the pipenv shell, we can test whether ...