Skip to content

Commit 1a4dfbb

Browse files
committed
remove incorrect comments, add link
1 parent 876cc2a commit 1a4dfbb

File tree

4 files changed

+2
-6
lines changed

4 files changed

+2
-6
lines changed

doc/en/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ should be changed to
7171
7272
You can also make use of `pytest_fixture_setup` to handle the coroutine/asyncgen before pytest sees it - this is the way current async pytest plugins handle it.
7373

74-
If a user has an async fixture with ``autouse=True`` in their ``conftest.py``, or in a file where they also have synchronous tests, they will also get this warning. We strongly recommend against this practice, and they should restructure their testing infrastructure so the fixture is synchronous or to separate the fixture from their synchronous tests. Note that the anyio pytest plugin has some support for sync test + async fixtures currently.
74+
If a user has an async fixture with ``autouse=True`` in their ``conftest.py``, or in a file where they also have synchronous tests, they will also get this warning. We strongly recommend against this practice, and they should restructure their testing infrastructure so the fixture is synchronous or to separate the fixture from their synchronous tests. Note that the `anyio pytest plugin <https://anyio.readthedocs.io/en/stable/testing.html>`_ has some support for sync test + async fixtures currently.
7575

7676

7777
.. _import-or-skip-import-error:

src/_pytest/compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class NotSetType(enum.Enum):
4444

4545

4646
def is_generator(func: object) -> bool:
47-
# note: this also returns true for async generator functions
4847
genfunc = inspect.isgeneratorfunction(func)
4948
return genfunc and not iscoroutinefunction(func)
5049

src/_pytest/fixtures.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,8 +885,6 @@ def call_fixture_func(
885885
fixturefunc: _FixtureFunc[FixtureValue], request: FixtureRequest, kwargs
886886
) -> FixtureValue:
887887
if is_generator(fixturefunc):
888-
# note: this also triggers on async generators, suppressing 'unawaited coroutine'
889-
# warning.
890888
fixturefunc = cast(
891889
Callable[..., Generator[FixtureValue, None, None]], fixturefunc
892890
)

testing/acceptance_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,7 @@ async def async_fixture():
13301330
yield
13311331
13321332
def test_foo(async_fixture):
1333-
# we don't need to suppress RuntimeWarning for unawaited coroutine
1334-
# as pytest internals accidentally do so already for async gens
1333+
# async gens don't emit unawaited-coroutine
13351334
...
13361335
"""
13371336
)

0 commit comments

Comments
 (0)