1 Our build framework sets PYTEST_PLUGINS to contain 'asyncio' and so the
2 pytest_plugins = 'pytest_asyncio'
3 line tries to load the plugin 2nd time. This emits additional warning and so
4 all tests that check the expected number of warnings fails here.
6 --- pytest_asyncio-0.24.0/tests/hypothesis/test_base.py.orig
7 +++ pytest_asyncio-0.24.0/tests/hypothesis/test_base.py
12 -def test_can_use_explicit_event_loop_fixture(pytester: Pytester):
13 +def test_can_use_explicit_event_loop_fixture(pytester: Pytester, monkeypatch):
18 from hypothesis import given
19 import hypothesis.strategies as st
21 - pytest_plugins = 'pytest_asyncio'
23 @pytest.fixture(scope="module")
25 loop = asyncio.get_event_loop_policy().new_event_loop()
30 + monkeypatch.setenv("PYTEST_PLUGINS", "asyncio")
31 result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default")
32 result.assert_outcomes(passed=1, warnings=2)
33 result.stdout.fnmatch_lines(
34 --- pytest_asyncio-0.24.0/tests/test_event_loop_fixture_finalizer.py.orig
35 +++ pytest_asyncio-0.24.0/tests/test_event_loop_fixture_finalizer.py
39 def test_event_loop_fixture_finalizer_raises_warning_when_fixture_leaves_loop_unclosed(
41 + pytester: Pytester, monkeypatch,
49 - pytest_plugins = 'pytest_asyncio'
53 loop = asyncio.get_event_loop_policy().new_event_loop()
58 + monkeypatch.setenv("PYTEST_PLUGINS", "asyncio")
59 result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W", "default")
60 result.assert_outcomes(passed=1, warnings=2)
61 result.stdout.fnmatch_lines("*unclosed event loop*")
64 def test_event_loop_fixture_finalizer_raises_warning_when_test_leaves_loop_unclosed(
66 + pytester: Pytester, monkeypatch,
74 - pytest_plugins = 'pytest_asyncio'
77 async def test_ends_with_unclosed_loop():
78 asyncio.set_event_loop(asyncio.new_event_loop())
82 + monkeypatch.setenv("PYTEST_PLUGINS", "asyncio")
83 result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W", "default")
84 result.assert_outcomes(passed=1, warnings=1)
85 result.stdout.fnmatch_lines("*unclosed event loop*")