-
-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] schema decorator does not play nice with pytest marks #1378
Comments
…chema.parametrize` if the schema is created via `from_pytest_fixture` Ref: #1378
Hi @schicks Sorry for not getting back to you earlier. What is the import pytest
import schemathesis
@pytest.fixture
def web_app():
1 / 0
schema = schemathesis.from_pytest_fixture("web_app")
@pytest.mark.acceptance
@schema.parametrize()
def test_schema(case):
1 / 0 Deselecting:
Selecting:
Environment:
Though, when the decorators' order is reversed, they are indeed ignored :( It should be solved by #1441 Am I missing something? |
…chema.parametrize` if the schema is created via `from_pytest_fixture` Ref: #1378
Checklist
Describe the bug
Because schemathesis can be quite slow and requires a testing version of the API to be set up, we have it behind
pytest.mark.acceptance
to avoid running it with unit tests. Unfortunately, the schema initializes when we set the schema variable, rather than when the test runs. To get around that, we useschemathesis.from_pytest_fixture
to get the schema. When themark.acceptance
is aboveschema.parametrize
, the tests hang forever. When it is belowschema.parametrize
, the schema is evaluated and errors because we don't have a test API running.To Reproduce
Steps to reproduce the behavior:
When this is run, tests will hang forever. When the decorators on the test are reversed and the test API is not running, tests will fail because the test API is not running.
This does not depend on the API schema, since the whole point is that the schema is not running.
Expected behavior
When the acceptance mark is deselected in the example above, the tests should pass. When the acceptance mark is selected in the example above, the tests should not stall out (and also, eventually, pass, as long as the test API is running in that context.)
Environment (please complete the following information):
Additional context
Any other workaround that allows us to skip this test with marks in a sane way would also be a welcome solution.
The text was updated successfully, but these errors were encountered: