Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pytest-dev/pytest-flask
A set of pytest fixtures to test Flask applications
https://github.com/pytest-dev/pytest-flask
flask pytest pytest-flask pytest-plugin python testing unit-testing
Last synced: 7 days ago
JSON representation
A set of pytest fixtures to test Flask applications
- Host: GitHub
- URL: https://github.com/pytest-dev/pytest-flask
- Owner: pytest-dev
- License: mit
- Created: 2014-09-03T12:51:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-04-29T22:31:59.000Z (9 months ago)
- Last Synced: 2024-05-18T15:45:00.736Z (8 months ago)
- Topics: flask, pytest, pytest-flask, pytest-plugin, python, testing, unit-testing
- Language: Python
- Homepage: http://pytest-flask.readthedocs.org/en/latest/
- Size: 262 KB
- Stars: 476
- Watchers: 11
- Forks: 87
- Open Issues: 13
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-flask - pytest-flask - A set of pytest fixtures to test Flask applications (Development (Debugging/Testing/Documentation))
- awesome-flask - pytest-flask - A set of pytest fixtures to test Flask applications (Development (Debugging/Testing/Documentation))
- awesome-flask - pytest-flask - A set of pytest fixtures to test Flask applications (Development (Debugging/Testing/Documentation))
- awesome-flask - Pytest-Flask - Pytest support for testing Flask applications. (Third-Party Extensions / Developer Tools)
- jimsghstars - pytest-dev/pytest-flask - A set of pytest fixtures to test Flask applications (Python)
- best-of-web-python - GitHub - 15% open · ⏱️ 27.12.2023): (Web Testing)
README
pytest-flask
============.. image:: https://img.shields.io/pypi/v/pytest-flask.svg
:target: https://pypi.python.org/pypi/pytest-flask
:alt: PyPi version.. image:: https://img.shields.io/conda/vn/conda-forge/pytest-flask.svg
:target: https://anaconda.org/conda-forge/pytest-flask
:alt: conda-forge version.. image:: https://github.com/pytest-dev/pytest-flask/workflows/build/badge.svg
:target: https://github.com/pytest-dev/pytest-flask/actions
:alt: CI status.. image:: https://img.shields.io/pypi/pyversions/pytest-flask.svg
:target: https://pypi.org/project/pytest-flask
:alt: PyPi downloads.. image:: https://readthedocs.org/projects/pytest-flask/badge/?version=latest
:target: https://pytest-flask.readthedocs.org/en/latest/
:alt: Documentation status.. image:: https://img.shields.io/maintenance/yes/2023?color=blue
:target: https://github.com/pytest-dev/pytest-flask
:alt: Maintenance.. image:: https://img.shields.io/github/last-commit/pytest-dev/pytest-flask?color=blue
:target: https://github.com/pytest-dev/pytest-flask/commits/master
:alt: GitHub last commit.. image:: https://img.shields.io/github/issues-pr-closed-raw/pytest-dev/pytest-flask?color=blue
:target: https://github.com/pytest-dev/pytest-flask/pulls?q=is%3Apr+is%3Aclosed
:alt: GitHub closed pull requests.. image:: https://img.shields.io/github/issues-closed/pytest-dev/pytest-flask?color=blue
:target: https://github.com/pytest-dev/pytest-flask/issues?q=is%3Aissue+is%3Aclosed
:alt: GitHub closed issues.. image:: https://img.shields.io/pypi/dm/pytest-flask?color=blue
:target: https://pypi.org/project/pytest-flask/
:alt: PyPI - Downloads.. image:: https://img.shields.io/github/languages/code-size/pytest-dev/pytest-flask?color=blue
:target: https://github.com/pytest-dev/pytest-flask
:alt: Code size.. image:: https://img.shields.io/badge/license-MIT-blue.svg?color=blue
:target: https://github.com/pytest-dev/pytest-flask/blob/master/LICENSE
:alt: License.. image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-flask.svg?color=blue
:target: https://github.com/pytest-dev/pytest-flask/issues
:alt: Issues.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: styleAn 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:
.. code-block:: python
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``:
.. code-block:: python
from myapp import create_app
@pytest.fixture
def app():
app = create_app()
return appFinally, install the extension with dependencies and run your test suite::
$ pip install pytest-flask
$ pytestContributing
------------Don’t hesitate to create a `GitHub issue`_ for any bug or
suggestion. For more information check our contribution `guidelines`_... _pytest: https://docs.pytest.org/en/stable/
.. _PyPI: https://pypi.python.org/pypi/pytest-flask
.. _Github issue: https://github.com/vitalk/pytest-flask/issues
.. _package documentation: http://pytest-flask.readthedocs.org/en/latest/
.. _guidelines: https://github.com/pytest-dev/pytest-flask/blob/master/CONTRIBUTING.rst
.. _application factory: https://flask.palletsprojects.com/patterns/appfactories/