I received the error
RuntimeError: Event loop is closed
each time I try to make more than one async call inside my test. I already tried to use all other suggestions from other Stack Overflow posts to rewrite the event_loop fixture but nothing works. I wonder what I'm missing?
Run test command:
python -m pytest tests/ --asyncio-mode=auto
requirements.txt
pytest==7.1.2
pytest-asyncio==0.18.3
pytest-html==3.1.1
pytest-metadata==2.0.1
test.py
async def test_user(test_client_fast_api):
    assert 200 == 200
    # works fine
    request_first = test_client_fast_api.post("/first_route")
    # recieve RuntimeError: Event loop is closed
    request_second = test_client_fast_api.post("/second_route")
conftest.py
@pytest.fixture()
def event_loop():
    try:
        loop = asyncio.get_running_loop()
    except RuntimeError:
        loop = asyncio.new_event_loop()
    yield loop
    loop.close()