-
Notifications
You must be signed in to change notification settings - Fork 179
Closed
pytest-dev/pytest
#12930Labels
enhancementNew feature or requestNew feature or request
Description
Things to check first
- I have searched the existing issues and didn't find my feature already requested there
Feature description
Sync test function attempting to use async fixture fails silently. pytest-trio will raise a RuntimeError in this instance.
The one possible downside is that this will break users who have async autouse fixtures in the same file where they have sync tests. But this restriction probably isn't too onerous, and may catch bugs as well.
Use case
Catch bugs and align behavior with pytest-trio
import pytest
pytestmark = pytest.mark.anyio
@pytest.fixture(autouse=True)
async def async_fixture():
assert False
yield
def test_1(async_fixture):
assert True
def test_2():
assert Truewill pass, but probably shouldn't
euri10
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request