PyTest produces warning DeprecationWarning: There is no current event loop

138 views Asked by At

I have added pytest-asyncio to my poetry test and dev groups with the following code:

    async def blah():
        return 1
    
    
    @pytest.mark.asyncio
    async def test_me(mock_client, mock_config, event_loop):
        res = await blah()
        assert 1 == res

When I run poetry run pytest I get this warning:

/Users/ykhaburzaniya/Library/Caches/pypoetry/virtualenvs/alakazam-6HJyiZWL-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:884: DeprecationWarning: There is no current event loop
    _loop = asyncio.get_event_loop()

In my poetry.lock I have pytest-asyncio version = "0.23.3".

What can I do to get rid of this warning?

0

There are 0 answers