Skip to content

How to run tests against a flask app returned from pytest fixture? #1510

Answered by Stranger6667
az-pz asked this question in Q&A
Discussion options

You must be logged in to vote

Here is an example, that you can transform to something like this:

@pytest.fixture
def app():
    app = flask.Flask('our_app')
    app_init(app, settings=settings)
    return app


schema = schemathesis.from_pytest_fixture("app")


@schema.parametrize()
def test_api(case, app):
    response = case.call_wsgi(app=app)
    case.validate_response(response)

Here is some more info, let me know if that helps.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by az-pz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants