Skip to main content

Start and stop the flask server for your tests

Project description

logo

Downloads Downloads codecov Hits-of-Code Tests Python versions PyPI version Checked with mypy Ruff

A simple plugin for Pytest containing a fixture that can start and stop the Flask server to run related tests. You just have to define the routes.

Install it by the command:

pip install flask_fixture

Define some routes in your conftest.py file:

from flask_fixture import endpoint

@endpoint('/')
def root():
    return 'some text'

And use a URL of a server in your tests as a fixture local_server_url:

import requests

def test_server(local_server_url):
    assert requests.get(local_server_url).text == 'some text'

The example uses the Requests library.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask_fixture-0.0.6.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

flask_fixture-0.0.6-py3-none-any.whl (12.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page