Patrick's Software Blog

Testing Flask Applications with Pytest

Notebook on a table with the Flask log on the side and a Learning Plan in the notebook listing the Application Context and Request Context.

Introduction

This blog post serves as a guide to testing Flask applications with pytest, including how to:

  • Create and run Flask-specific unit and functional tests with pytest
  • Utilize fixtures to initialize the state for test functions
  • Check the coverage of the tests using coverage.py

The full article can be found on TestDriven.io: https://testdriven.io/blog/flask-pytest/