diff --git a/changelog.d/1275.downstream.rst b/changelog.d/1275.downstream.rst new file mode 100644 index 00000000..3df2e557 --- /dev/null +++ b/changelog.d/1275.downstream.rst @@ -0,0 +1 @@ +Tests are run in the same pytest process, instead of spawning a subprocess with `pytest.Pytester.runpytest_subprocess`. This prevents the test suite from accidentally using a system installation of pytest-asyncio, which could result in test errors. diff --git a/tests/hypothesis/test_base.py b/tests/hypothesis/test_base.py index 487b05fe..76392ee5 100644 --- a/tests/hypothesis/test_base.py +++ b/tests/hypothesis/test_base.py @@ -27,7 +27,7 @@ async def test_mark_inner(n): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default") result.assert_outcomes(passed=1) diff --git a/tests/markers/test_class_scope.py b/tests/markers/test_class_scope.py index e8732e86..15a8fdc4 100644 --- a/tests/markers/test_class_scope.py +++ b/tests/markers/test_class_scope.py @@ -3,6 +3,7 @@ from __future__ import annotations import asyncio +import sys from textwrap import dedent import pytest @@ -143,8 +144,15 @@ async def test_does_not_use_custom_event_loop_policy(): """ ) ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=3) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_respects_parametrized_loop_policies( @@ -175,8 +183,15 @@ async def test_parametrized_loop(self, request): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=2) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_provides_class_scoped_loop_to_fixtures( @@ -205,7 +220,7 @@ async def test_runs_is_same_loop_as_fixture(self, my_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -293,5 +308,5 @@ async def test_anything(self): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(warnings=0, passed=1) diff --git a/tests/markers/test_function_scope.py b/tests/markers/test_function_scope.py index 16d45da5..97ea08e6 100644 --- a/tests/markers/test_function_scope.py +++ b/tests/markers/test_function_scope.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from textwrap import dedent from pytest import Pytester @@ -87,7 +88,7 @@ async def test_warns(): """ ) ) - result = pytester.runpytest("--asyncio-mode=strict", "--assert=plain") + result = pytester.runpytest("--asyncio-mode=strict", "-W", "default") result.assert_outcomes(passed=1, warnings=1) result.stdout.fnmatch_lines("*DeprecationWarning*") @@ -119,8 +120,15 @@ async def test_uses_custom_event_loop_policy(): """ ), ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=1) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=1, warnings=2) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=1) def test_asyncio_mark_respects_parametrized_loop_policies( @@ -157,8 +165,15 @@ async def test_parametrized_loop(): """ ) ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=3) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_provides_function_scoped_loop_to_fixtures( diff --git a/tests/markers/test_invalid_arguments.py b/tests/markers/test_invalid_arguments.py index 2d5c3552..2663ef95 100644 --- a/tests/markers/test_invalid_arguments.py +++ b/tests/markers/test_invalid_arguments.py @@ -8,6 +8,7 @@ def test_no_error_when_scope_passed_as_sole_keyword_argument( pytester: pytest.Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -19,7 +20,7 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess() + result = pytester.runpytest("--assert=plain") result.assert_outcomes(passed=1) result.stdout.no_fnmatch_line("*ValueError*") @@ -27,6 +28,7 @@ async def test_anything(): def test_error_when_scope_passed_as_positional_argument( pytester: pytest.Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -38,7 +40,7 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess() + result = pytester.runpytest("--assert=plain") result.assert_outcomes(errors=1) result.stdout.fnmatch_lines( ["*ValueError: mark.asyncio accepts only a keyword argument*"] @@ -48,6 +50,7 @@ async def test_anything(): def test_error_when_wrong_keyword_argument_is_passed( pytester: pytest.Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -59,7 +62,7 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess() + result = pytester.runpytest("--assert=plain") result.assert_outcomes(errors=1) result.stdout.fnmatch_lines( ["*ValueError: mark.asyncio accepts only a keyword argument 'loop_scope'*"] @@ -69,6 +72,7 @@ async def test_anything(): def test_error_when_additional_keyword_arguments_are_passed( pytester: pytest.Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -80,7 +84,7 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess() + result = pytester.runpytest("--assert=plain") result.assert_outcomes(errors=1) result.stdout.fnmatch_lines( ["*ValueError: mark.asyncio accepts only a keyword argument*"] diff --git a/tests/markers/test_module_scope.py b/tests/markers/test_module_scope.py index a050f503..633e6121 100644 --- a/tests/markers/test_module_scope.py +++ b/tests/markers/test_module_scope.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from textwrap import dedent from pytest import Pytester @@ -87,8 +88,15 @@ async def test_does_not_use_custom_event_loop_policy(): """ ), ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=3) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_respects_parametrized_loop_policies( @@ -119,8 +127,15 @@ async def test_parametrized_loop(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=2) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_provides_module_scoped_loop_to_fixtures( @@ -150,7 +165,7 @@ async def test_runs_is_same_loop_as_fixture(my_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -298,5 +313,5 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(warnings=0, passed=1) diff --git a/tests/markers/test_package_scope.py b/tests/markers/test_package_scope.py index 3e41459b..76bd85ea 100644 --- a/tests/markers/test_package_scope.py +++ b/tests/markers/test_package_scope.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from textwrap import dedent from pytest import Pytester @@ -127,8 +128,15 @@ async def test_also_uses_custom_event_loop_policy(): """ ), ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=3) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_respects_parametrized_loop_policies( @@ -160,8 +168,15 @@ async def test_parametrized_loop(): """ ), ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=2) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_provides_package_scoped_loop_to_fixtures( @@ -207,7 +222,7 @@ async def test_runs_in_same_loop_as_fixture(my_fixture): """ ), ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) diff --git a/tests/markers/test_session_scope.py b/tests/markers/test_session_scope.py index 2d3a4993..88eec6c3 100644 --- a/tests/markers/test_session_scope.py +++ b/tests/markers/test_session_scope.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from textwrap import dedent from pytest import Pytester @@ -128,8 +129,15 @@ async def test_also_uses_custom_event_loop_policy(): """ ), ) - result = pytester.runpytest("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=3) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_respects_parametrized_loop_policies( @@ -161,8 +169,15 @@ async def test_parametrized_loop(): """ ), ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") - result.assert_outcomes(passed=2) + pytest_args = ["--asyncio-mode=strict"] + if sys.version_info >= (3, 14): + pytest_args.extend(["-W", "default"]) + result = pytester.runpytest(*pytest_args) + if sys.version_info >= (3, 14): + result.assert_outcomes(passed=2, warnings=2) + result.stdout.fnmatch_lines("*DefaultEventLoopPolicy*") + else: + result.assert_outcomes(passed=2) def test_asyncio_mark_provides_session_scoped_loop_to_fixtures( @@ -212,7 +227,7 @@ async def test_runs_in_same_loop_as_fixture(my_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -423,5 +438,5 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(warnings=0, passed=1) diff --git a/tests/modes/test_strict_mode.py b/tests/modes/test_strict_mode.py index d7dc4ac6..0a467c18 100644 --- a/tests/modes/test_strict_mode.py +++ b/tests/modes/test_strict_mode.py @@ -94,7 +94,7 @@ async def test_anything(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") if pytest_version >= (8, 4, 0): result.assert_outcomes(failed=1, skipped=0, warnings=0) else: @@ -119,7 +119,7 @@ async def test_anything(any_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") if pytest_version >= (8, 4, 0): result.assert_outcomes(failed=1, skipped=0, warnings=2) @@ -155,7 +155,7 @@ async def test_anything(any_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") if pytest_version >= (8, 4, 0): result.assert_outcomes(passed=1, failed=0, skipped=0, warnings=2) else: @@ -202,7 +202,7 @@ async def test_anything(any_fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") if pytest_version >= (8, 4, 0): result.assert_outcomes(passed=1, warnings=2) else: diff --git a/tests/test_asyncio_mark.py b/tests/test_asyncio_mark.py index 81731adb..f4e88ba2 100644 --- a/tests/test_asyncio_mark.py +++ b/tests/test_asyncio_mark.py @@ -6,6 +6,7 @@ def test_asyncio_mark_on_sync_function_emits_warning(pytester: Pytester): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -17,7 +18,7 @@ def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") result.assert_outcomes(passed=1) result.stdout.fnmatch_lines( ["*is marked with '@pytest.mark.asyncio' but it is not an async function.*"] @@ -27,6 +28,7 @@ def test_a(): def test_asyncio_mark_on_async_generator_function_emits_warning_in_strict_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -38,7 +40,7 @@ async def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] @@ -48,6 +50,7 @@ async def test_a(): def test_asyncio_mark_on_async_generator_function_emits_warning_in_auto_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -56,7 +59,7 @@ async def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=auto", "-W default") + result = pytester.runpytest("--asyncio-mode=auto", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] @@ -66,6 +69,7 @@ async def test_a(): def test_asyncio_mark_on_async_generator_method_emits_warning_in_strict_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -78,7 +82,7 @@ async def test_a(self): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] @@ -88,6 +92,7 @@ async def test_a(self): def test_asyncio_mark_on_async_generator_method_emits_warning_in_auto_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -98,7 +103,7 @@ async def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=auto", "-W default") + result = pytester.runpytest("--asyncio-mode=auto", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] @@ -108,6 +113,7 @@ async def test_a(): def test_asyncio_mark_on_async_generator_staticmethod_emits_warning_in_strict_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -121,7 +127,7 @@ async def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W default") + result = pytester.runpytest("--asyncio-mode=strict", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] @@ -131,6 +137,7 @@ async def test_a(): def test_asyncio_mark_on_async_generator_staticmethod_emits_warning_in_auto_mode( pytester: Pytester, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( """\ @@ -141,7 +148,7 @@ async def test_a(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=auto", "-W default") + result = pytester.runpytest("--asyncio-mode=auto", "-W default", "--assert=plain") result.assert_outcomes(xfailed=1, warnings=1) result.stdout.fnmatch_lines( ["*Tests based on asynchronous generators are not supported*"] diff --git a/tests/test_event_loop_fixture.py b/tests/test_event_loop_fixture.py index 8b9ac634..5a03341f 100644 --- a/tests/test_event_loop_fixture.py +++ b/tests/test_event_loop_fixture.py @@ -5,56 +5,6 @@ from pytest import Pytester -def test_event_loop_fixture_respects_event_loop_policy(pytester: Pytester): - pytester.makeconftest( - dedent( - """\ - '''Defines and sets a custom event loop policy''' - import asyncio - from asyncio import DefaultEventLoopPolicy, SelectorEventLoop - - class TestEventLoop(SelectorEventLoop): - pass - - class TestEventLoopPolicy(DefaultEventLoopPolicy): - def new_event_loop(self): - return TestEventLoop() - - # This statement represents a code which sets a custom event loop policy - asyncio.set_event_loop_policy(TestEventLoopPolicy()) - """ - ) - ) - pytester.makepyfile( - dedent( - """\ - '''Tests that any externally provided event loop policy remains unaltered''' - import asyncio - - import pytest - - - @pytest.mark.asyncio - async def test_uses_loop_provided_by_custom_policy(): - '''Asserts that test cases use the event loop - provided by the custom event loop policy''' - assert type(asyncio.get_event_loop()).__name__ == "TestEventLoop" - - - @pytest.mark.asyncio - async def test_custom_policy_is_not_overwritten(): - ''' - Asserts that any custom event loop policy stays the same - across test cases. - ''' - assert type(asyncio.get_event_loop()).__name__ == "TestEventLoop" - """ - ) - ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") - result.assert_outcomes(passed=2) - - def test_event_loop_fixture_handles_unclosed_async_gen( pytester: Pytester, ): @@ -78,7 +28,7 @@ async def generator_fn(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W", "default") + result = pytester.runpytest("--asyncio-mode=strict", "-W", "default") result.assert_outcomes(passed=1, warnings=0) @@ -110,7 +60,7 @@ async def test_something(close_event_loop): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest_subprocess("--asyncio-mode=strict", "--assert=plain") result.assert_outcomes(passed=1, warnings=1) result.stdout.fnmatch_lines( ["*An exception occurred during teardown of an asyncio.Runner*"] @@ -139,5 +89,5 @@ async def fail(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict", "-W", "default") + result = pytester.runpytest("--asyncio-mode=strict", "-W", "default") result.assert_outcomes(passed=1, warnings=1) diff --git a/tests/test_fixture_loop_scopes.py b/tests/test_fixture_loop_scopes.py index 95e46818..037b561a 100644 --- a/tests/test_fixture_loop_scopes.py +++ b/tests/test_fixture_loop_scopes.py @@ -13,6 +13,7 @@ def test_loop_scope_session_is_independent_of_fixture_scope( pytester: Pytester, fixture_scope: str, ): + pytester.makeini("[pytest]\nasyncio_default_fixture_loop_scope = function") pytester.makepyfile( dedent( f"""\ @@ -34,7 +35,7 @@ async def test_runs_in_same_loop_as_fixture(fixture): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -68,7 +69,7 @@ async def test_runs_in_fixture_loop(fixture_loop): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -101,7 +102,7 @@ async def test_runs_in_fixture_loop(self, fixture_loop): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -134,7 +135,7 @@ async def test_runs_in_fixture_loop(fixture_loop): """ ), ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=1) @@ -145,7 +146,7 @@ def test_invalid_default_fixture_loop_scope_raises_error(pytester: Pytester): asyncio_default_fixture_loop_scope = invalid_scope """ ) - result = pytester.runpytest() + result = pytester.runpytest("--assert=plain") result.stderr.fnmatch_lines( [ "ERROR: 'invalid_scope' is not a valid " diff --git a/tests/test_set_event_loop.py b/tests/test_set_event_loop.py index 20037b48..a2f5dfaa 100644 --- a/tests/test_set_event_loop.py +++ b/tests/test_set_event_loop.py @@ -173,7 +173,7 @@ async def test_verify_original_loop_reinstated(): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=3) @@ -252,7 +252,7 @@ async def test_after(webserver): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=3) @@ -367,5 +367,5 @@ async def test_after_second(second_webserver): """ ) ) - result = pytester.runpytest_subprocess("--asyncio-mode=strict") + result = pytester.runpytest("--asyncio-mode=strict") result.assert_outcomes(passed=5)