Skip to content

Commit

Permalink
Disable autouse on asyncio_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 7, 2025
1 parent 933273c commit 9dabd29
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions panel/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ def stop_event():
finally:
event.set()

@pytest.fixture
def asyncio_loop():
try:
loop = asyncio.get_event_loop()
except (RuntimeError, DeprecationWarning):
loop = asyncio.new_event_loop()
asyncio.set_event_loop(asyncio.new_event_loop())
yield
loop.stop()

@pytest.fixture
async def watch_files():
tasks = []
Expand Down Expand Up @@ -324,9 +334,8 @@ def tmpdir(request, tmpdir_factory):
yield tmp_dir
shutil.rmtree(str(tmp_dir))


@pytest.fixture
def html_server_session():
def html_server_session(asyncio_loop):
port = 5050
html = HTML('<h1>Title</h1>')
server = serve(html, port=port, show=False, start=False)
Expand All @@ -341,13 +350,6 @@ def html_server_session():
except AssertionError:
pass # tests may already close this

@pytest.fixture(autouse=True)
def asyncio_loop():
try:
asyncio.get_event_loop()
except (RuntimeError, DeprecationWarning):
asyncio.set_event_loop(asyncio.new_event_loop())

@pytest.fixture()
def markdown_server_session():
port = 5051
Expand Down

0 comments on commit 9dabd29

Please sign in to comment.