pytest-asyncio icon indicating copy to clipboard operation
pytest-asyncio copied to clipboard

Asyncio support for pytest

Results 87 pytest-asyncio issues
Sort by recently updated
recently updated
newest added

Hello! Something has been broken with the latest pytest-asyncio releases. Consider such code: ```python import asyncio import pytest @pytest.fixture(scope='session') def event_loop(): loop = asyncio.get_event_loop_policy().new_event_loop() yield loop loop.close() @pytest.fixture(scope='session') async def...

bug

When running the test suite on Python 3.11, tests with a `@pytest.mark.asyncio` decorator, trigger a DeprecationWarning: ``` .../python3.11/site-packages/pytest_asyncio/plugin.py:884: DeprecationWarning: There is no current event loop _loop = asyncio.get_event_loop() ```

bug

I was using a `event_loop` fixture to use a custom event loop class, and noticed the warning from pytest to not do that and use an event loop policy instead....

By default pytest does not import all modules so it is fine if they have import errors due to optional dependencies. You can cause pytest to import all modules if...

bug

Contrary to the statements in the documentation ([here](https://github.com/pytest-dev/pytest-asyncio/blob/b60649a648912a79ce6f3443ca7ac2c67fe9a5b7/docs/source/how-to-guides/multiple_loops.rst?plain=1#L5) and [here](https://github.com/pytest-dev/pytest-asyncio/blob/b60649a648912a79ce6f3443ca7ac2c67fe9a5b7/docs/source/reference/fixtures/index.rst?plain=1#L34-L35)), the fixture is not only applied to all pytest-asyncio tests, but also applied to all other tests. ```python import asyncio...

When a user wants to run all tests in a session-scoped event loop, the documentation suggests implementing a _pytest_collection_modifyitems_ hook. In _auto_ mode the hook causes duplicate _asyncio_ markers to...

enhancement

...and [according to pyright upstream](https://github.com/microsoft/pyright/issues/3497#issuecomment-1134850832), this is a bug in mypy, rather than in pyright. Type-checking pytest-asyncio itself yields a great many errors, starting with: ```none pytest-asyncio/pytest_asyncio/plugin.py:57:60 - error: Type...

enhancement
good first issue

#737 has added support for pytest 8. After some time, pytest-asyncio should drop support for the obsolete pytest 7.

I checked in all the files referenced below into this repo: https://github.com/danking/pytest-asyncio-confusion ``` pytest==7.4.3 pytest-asyncio==0.23.3 ``` Simple test file: ```python3 import pytest import asyncio @pytest.fixture(scope='session') async def foo(): yield asyncio.get_running_loop()...

bug

test case for tangential issue discovered trying to [provide an example use case](https://github.com/pytest-dev/pytest-asyncio/issues/706#issuecomment-1918982285) for #706. When a function-scoped async fixture is used, `@pytest.mark.asyncio(scope="module")` on tests is ignored. Notably, when the...