pytest-asyncio
pytest-asyncio copied to clipboard
Asyncio support for pytest
Consider the two test cases below: ``` @pytest.mark.asyncio async def test_mocksocket_mocker(mocker): mocker.patch('socket.socket', wraps=MockSocket) pass @pytest.mark.asyncio async def test_mocksocket_loop_mocker(event_loop, mocker): mocker.patch('socket.socket', wraps=MockSocket) pass ``` The top one reports `ERROR at teardown...
## Description With `pytest-asyncio` and `async def test_...()` function decorated with `@pytest.mark.xyz` each marker appears twice in `request.node.iter_markers_with_node()`. ## Environment `pip list` ``` Package Version -------------- ------- iniconfig 2.0.0 packaging...
Recently I used `pytest.mark.asyncio("session")` instead of `pytest.mark.asyncio(scope="session")`. It took me quite a while to find out why the corresponding test was function scoped instead of session scoped. It would be...
It seems pytest-asyncio (`0.23.7`) is currently badly broken with code relying on `aiohttp`. This simple example currently breaks. The example is heavily simplified from the actual fixture setup. This used...
Fixes #813
I just want to use module scope fixture but I get an error: **[environment]** python==3.10.14 pytest==8.2.2 pytest-asyncio==0.23.7 **[Directory]** `tests/conftest.py`: ```python import pytest_asyncio @pytest_asyncio.fixture(scope="module") async def foo(): yield "a value" ```...
I keep getting this error message even after installing pytest-asyncio and restarting my terminal. Python 3.9.0, Pytest 8.2.1