Welcome to pytest-flask’s documentation! — pytest-flask 1.3.1.dev43+g561a2bb documentation (original) (raw)
Pytest-flask is a plugin for pytest that provides a set of useful tools to test Flask applications and extensions.
Quickstart¶
Install plugin via pip
:
Define your application fixture in conftest.py
:
from myapp import create_app
@pytest.fixture def app(): app = create_app() return app
Now you can use the app
fixture in your test suite. You can run your tests with:
User’s Guide¶
This part of the documentation will show you how to get started in using pytest-flask with your application.
- Getting started
- Feature reference
- Fixtures
* client - application test client
* client_class - application test client for class-based tests
* config - application config
* live_server - application live server
* --start-live-server - start live server automatically (default)
* --no-start-live-server - don’t start live server automatically
* --live-server-wait - the live server wait timeout (5 seconds)
* --live-server-port - use a fixed port
* live_server_scope - set the scope of the live server
* HTTP Request
* Content negotiation
* accept_any - */* accept header
* accept_json - application/json accept header
* accept_jsonp - application/json-p accept header - Markers
* pytest.mark.options - pass options to your application config
* pytest.mark.options()
- Fixtures
- How to contribute
- Changelog
- UNRELEASED
- 1.3.0 (2023-10-23)
- 1.2.1
- 1.2.0 (2021-02-26)
- 1.1.0 (2020-11-08)
- 1.0.0 (2020-03-03)
- 0.15.1 (2020-02-03)
- 0.15.0 (2019-05-13)
- 0.14.0 (2018-10-15)
- 0.13.0 (2018-09-29)
- 0.12.0 (2018-09-06)
- 0.11.0 (compared to 0.10.0)
- 0.10.0 (compared to 0.9.0)
- 0.9.0 (compared to 0.8.1)
- 0.8.1
- 0.8.0
- 0.7.5
- 0.7.4
- 0.7.3
- 0.7.2
- 0.7.1
- 0.7.0
- 0.6.3
- 0.6.2
- 0.6.1
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.4
- 0.3.3
- 0.3.2
- 0.3.1