RuntimeError("Task <Task pending name='Task-5' coro=<test_root() running at /home/david/PycharmProjects/work/tests/main_test.py:12> cb=[_run_until_complete_cb() at /usr/lib/python3.8/asyncio/base_events.py:184]> got Future <Future pending cb=[Protocol._on_waiter_completed()]> attached to a different loop")
How to fix this issue? In docs there a mention of github comment with a solution, but it's outdated and unclear how to apply provided solution to my code (similar to code from docs).
My code:
import pytest
from httpx import AsyncClient
import main # File with uvicorn starting
from tests import conftest # File with code from a [link][2]
@pytest.mark.asyncio()
async def test_root():
async with AsyncClient(app=main.app, base_url="http://test") as ac:
response = conftest.event_loop(await ac.post("/register", json={
"phone_number": "+7 931 964 0000",
"full_name": "Alex Balex"
}))
assert response.status_code == 201