python/pyproject_installer: update to 0.5.5
[oi-userland.git] / components / python / pytest-asyncio / patches / 01-PYTEST_PLUGINS.patch
blob99f6bd5710975badd11a15ccf4ab2bb9f672be8f
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
8 @@ -41,7 +41,7 @@
9 assert y in (1, 2)
12 -def test_can_use_explicit_event_loop_fixture(pytester: Pytester):
13 +def test_can_use_explicit_event_loop_fixture(pytester: Pytester, monkeypatch):
14 pytester.makepyfile(
15 dedent(
16 """\
17 @@ -50,8 +50,6 @@
18 from hypothesis import given
19 import hypothesis.strategies as st
21 - pytest_plugins = 'pytest_asyncio'
23 @pytest.fixture(scope="module")
24 def event_loop():
25 loop = asyncio.get_event_loop_policy().new_event_loop()
26 @@ -67,6 +65,7 @@
27 """
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
36 @@ -92,7 +92,7 @@
39 def test_event_loop_fixture_finalizer_raises_warning_when_fixture_leaves_loop_unclosed(
40 - pytester: Pytester,
41 + pytester: Pytester, monkeypatch,
43 pytester.makepyfile(
44 dedent(
45 @@ -100,8 +100,6 @@
46 import asyncio
47 import pytest
49 - pytest_plugins = 'pytest_asyncio'
51 @pytest.fixture
52 def event_loop():
53 loop = asyncio.get_event_loop_policy().new_event_loop()
54 @@ -113,13 +111,14 @@
55 """
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(
65 - pytester: Pytester,
66 + pytester: Pytester, monkeypatch,
68 pytester.makepyfile(
69 dedent(
70 @@ -127,14 +126,13 @@
71 import asyncio
72 import pytest
74 - pytest_plugins = 'pytest_asyncio'
76 @pytest.mark.asyncio
77 async def test_ends_with_unclosed_loop():
78 asyncio.set_event_loop(asyncio.new_event_loop())
79 """
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*")