When trying to do UI automtion with pytest-asyncio and pytest-playwright, I got exception like: RuntimeError: Cannot run the event loop while another loop is running
Code structure:
ui2/conftest.py
ui2/test_bing.py
 
ui2/conftest.py
import pytest
import asyncio
@pytest.fixture(scope="session")
def event_loop():
    """重写event_loop"""
    loop = asyncio.get_event_loop()
    yield loop
    loop.close()
 
ui2/test_bing.py
import pytest
from playwright.async_api import Page
@pytest.mark.asyncio
async def test_bing(page: Page):
    await page.goto("http://www.bing.com/")
 
env:
pytest==7.1.2
pytest-asyncio==0.18.3
pytest-playwright==0.3.0
 
Detail exception as below:
