You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pytest no longer supports tests based generator functions and will xfail the respective test:
test_generator.py
deftest_gen():
yield
$ pytest test_generator.py ============================================================================================================================ test session starts =============================================================================================================================platform linux -- Python 3.11.6, pytest-7.4.2, pluggy-1.3.0rootdir: /tmp/tstplugins: asyncio-0.21.1asyncio: mode=Mode.STRICTcollected 1 item test_generator.py x [100%]============================================================================================================================== warnings summary ==============================================================================================================================test_generator.py:1 test_generator.py:1: PytestCollectionWarning: yield tests were removed in pytest 4.0 - test_gen will be ignored def test_gen():-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html======================================================================================================================= 1 xfailed, 1 warning in 0.15s ========================================================================================================================
Pytest-asyncio v0.21.1 simply refuses to take care of async generator functions, which causes pytest to complain about a missing plugin for async tests.
test_a.py
asyncdeftest_async_gen():
yield
$ pytest --asyncio-mode=auto test_a.py============================================================================================================================ test session starts =============================================================================================================================platform linux -- Python 3.11.6, pytest-7.4.2, pluggy-1.3.0rootdir: /tmp/tstplugins: asyncio-0.21.1asyncio: mode=Mode.AUTOcollected 1 item test_a.py s [100%]============================================================================================================================== warnings summary ==============================================================================================================================test_a.py::test_async_gen /tmp/tst/venv/lib/python3.11/site-packages/_pytest/python.py:183: PytestUnhandledCoroutineWarning: async def functions are not natively supported and have been skipped. You need to install a suitable plugin for your async framework, for example: - anyio - pytest-asyncio - pytest-tornasync - pytest-trio - pytest-twisted warnings.warn(PytestUnhandledCoroutineWarning(msg.format(nodeid)))-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html======================================================================================================================= 1 skipped, 1 warning in 0.03s ========================================================================================================================
Pytest-asyncio should handle tests based on asynchronous generator functions and raise a warning similar to pytest.
The text was updated successfully, but these errors were encountered:
Pytest no longer supports tests based generator functions and will xfail the respective test:
test_generator.py
Pytest-asyncio v0.21.1 simply refuses to take care of async generator functions, which causes pytest to complain about a missing plugin for async tests.
test_a.py
Pytest-asyncio should handle tests based on asynchronous generator functions and raise a warning similar to pytest.
The text was updated successfully, but these errors were encountered: