Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Jan 7, 2025
1 parent 93ad2fc commit 933273c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion panel/tests/chat/test_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ def append_callback(message, instance):
chat_feed.post_hook = append_callback
chat_feed.send("Hello World!")
await async_wait_until(lambda: chat_feed.objects[-1].object == "Echo: Hello World!")
assert logs == ["Hello World!", "Echo: Hello World!"]
await async_wait_until(lambda: logs == ["Hello World!", "Echo: Hello World!"])

async def test_generator(self, chat_feed):
def callback(contents, user, instance):
Expand Down
8 changes: 7 additions & 1 deletion panel/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def tmpdir(request, tmpdir_factory):
shutil.rmtree(str(tmp_dir))


@pytest.fixture()
@pytest.fixture
def html_server_session():
port = 5050
html = HTML('<h1>Title</h1>')
Expand All @@ -341,6 +341,12 @@ 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():
Expand Down
6 changes: 3 additions & 3 deletions panel/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def app(counts=[0]):


@pytest.mark.xdist_group(name="server")
def test_show_server_info(html_server_session, markdown_server_session):
def test_show_server_info(asyncio_loop, html_server_session, markdown_server_session):
*_, html_port = html_server_session
*_, markdown_port = markdown_server_session
server_info = repr(state)
Expand All @@ -488,7 +488,7 @@ def test_show_server_info(html_server_session, markdown_server_session):


@pytest.mark.xdist_group(name="server")
def test_kill_all_servers(html_server_session, markdown_server_session):
def test_kill_all_servers(asyncio_loop, html_server_session, markdown_server_session):
_, server_1, *_ = html_server_session
_, server_2, *_ = markdown_server_session
state.kill_all_servers()
Expand All @@ -497,7 +497,7 @@ def test_kill_all_servers(html_server_session, markdown_server_session):


@pytest.mark.xdist_group(name="server")
def test_multiple_titles(multiple_apps_server_sessions):
def test_multiple_titles(asyncio_loop, multiple_apps_server_sessions):
"""Serve multiple apps with a title per app."""
session1, session2 = multiple_apps_server_sessions(
slugs=('app1', 'app2'), titles={'app1': 'APP1', 'app2': 'APP2'})
Expand Down
3 changes: 3 additions & 0 deletions panel/tests/ui/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pytest

pytestmark = pytest.mark.asyncio(loop_scope="package")

0 comments on commit 933273c

Please sign in to comment.