forked from pytest-dev/pytest-asyncio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Do not try to initialize async fixtures without explicit asyncio…
… mark in strict mode. This fixes a bug that breaks compatibility with pytest_trio. Closes pytest-dev#298 Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
- Loading branch information
Showing
3 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from textwrap import dedent | ||
|
||
|
||
def test_strict_mode_ignores_trio_fixtures(testdir): | ||
testdir.makepyfile( | ||
dedent( | ||
"""\ | ||
import pytest | ||
import pytest_asyncio | ||
import pytest_trio | ||
pytest_plugins = ["pytest_asyncio", "pytest_trio"] | ||
@pytest_trio.trio_fixture | ||
async def any_fixture(): | ||
return True | ||
@pytest.mark.trio | ||
async def test_anything(any_fixture): | ||
pass | ||
""" | ||
) | ||
) | ||
result = testdir.runpytest("--asyncio-mode=strict") | ||
result.assert_outcomes(passed=1) |