Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1334.downstream.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Avoided a ``PytestAssertRewriteWarning`` in the test suite when pytest-asyncio is already imported, such as when tests are run against a system-installed copy on Guix or FreeBSD.
2 changes: 1 addition & 1 deletion tests/markers/test_class_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,5 +274,5 @@ class TestClass:
async def test_anything(self):
pass
"""))
result = pytester.runpytest("--asyncio-mode=strict")
result = pytester.runpytest("--asyncio-mode=strict", "--assert=plain")
result.assert_outcomes(warnings=0, passed=1)
4 changes: 3 additions & 1 deletion tests/markers/test_function_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def test_warns_when_scope_argument_is_present(pytester: Pytester):
async def test_warns():
...
"""))
result = pytester.runpytest("--asyncio-mode=strict", "-W", "default")
result = pytester.runpytest(
"--asyncio-mode=strict", "-W", "default", "--assert=plain"
)
result.assert_outcomes(passed=1, warnings=1)
result.stdout.fnmatch_lines("*DeprecationWarning*")

Expand Down
2 changes: 1 addition & 1 deletion tests/markers/test_module_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,5 +281,5 @@ def test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_be
async def test_anything():
pass
"""))
result = pytester.runpytest("--asyncio-mode=strict")
result = pytester.runpytest("--asyncio-mode=strict", "--assert=plain")
result.assert_outcomes(warnings=0, passed=1)
2 changes: 1 addition & 1 deletion tests/markers/test_session_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,5 +392,5 @@ def test_standalone_test_does_not_trigger_warning_about_no_current_event_loop_be
async def test_anything():
pass
"""))
result = pytester.runpytest("--asyncio-mode=strict")
result = pytester.runpytest("--asyncio-mode=strict", "--assert=plain")
result.assert_outcomes(warnings=0, passed=1)
4 changes: 0 additions & 4 deletions tests/test_event_loop_fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def test_event_loop_fixture_handles_unclosed_async_gen(
import asyncio
import pytest

pytest_plugins = 'pytest_asyncio'

@pytest.mark.asyncio
async def test_something():
async def generator_fn():
Expand Down Expand Up @@ -67,8 +65,6 @@ def test_event_loop_fixture_asyncgen_error(
import asyncio
import pytest

pytest_plugins = 'pytest_asyncio'

@pytest.mark.asyncio
async def test_something():
# mock shutdown_asyncgen failure
Expand Down
Loading