Skip to content

Repository files navigation

pytest-flask

PyPi versionconda-forge versionCI statusPyPi downloadsDocumentation statusMaintenanceGitHub last commitGitHub closed pull requestsGitHub closed issuesPyPI - DownloadsCode sizeLicenseIssuesstyle

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:

fromflaskimportFlaskdefcreate_app():
# create a minimal appapp=Flask(__name__)
# simple hello world view@app.route('/hello')defhello():
return'Hello, World!'returnapp

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

frommyappimportcreate_app@pytest.fixturedefapp():
app=create_app()
returnapp

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.

About

A set of pytest fixtures to test Flask applications

Topics

Resources

Code of conduct

Contributing

Stars

499 stars

Watchers

11 watching

Forks

Releases

Packages

Used by

Contributors

Languages