Skip to content

pytest-dev/pytest-flask

Folders and files

NameName
Last commit message
Last commit date
Oct 23, 2023
Oct 31, 2023
Oct 29, 2023
Oct 8, 2024
Oct 23, 2023
Oct 29, 2023
Jan 7, 2025
Nov 1, 2023
Oct 6, 2020
Nov 25, 2024
Mar 25, 2016
Nov 1, 2023
Oct 9, 2023
Oct 29, 2023
Oct 8, 2024
Oct 23, 2023
Oct 31, 2023

Repository files navigation

pytest-flask

PyPi version conda-forge version CI status PyPi downloads Documentation status Maintenance GitHub last commit GitHub closed pull requests GitHub closed issues PyPI - Downloads Code size License Issues style

An extension of pytest test runner which provides a set of useful tools to simplify testing and development of the Flask extensions and applications.

To view a more detailed list of extension features and examples go to the PyPI overview page or package documentation.

How to start?

Considering the minimal flask application factory below in myapp.py as an example:

from flask import Flask

def create_app():
   # create a minimal app
   app = Flask(__name__)

   # simple hello world view
   @app.route('/hello')
   def hello():
      return 'Hello, World!'

   return app

You first need to define your application fixture in conftest.py:

from myapp import create_app

@pytest.fixture
def app():
    app = create_app()
    return app

Finally, install the extension with dependencies and run your test suite:

$ pip install pytest-flask
$ pytest

Contributing

Don’t hesitate to create a GitHub issue for any bug or suggestion. For more information check our contribution guidelines.