Skip to content

Commit

Permalink
Fix test-CI (#6909)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Jun 10, 2024
1 parent 681ddc9 commit c90ffd4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
15 changes: 10 additions & 5 deletions panel/pane/holoviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
from pyviz_comms import Comm


def check_holoviews(version):
import holoviews as hv

return Version(Version(hv.__version__).base_version) >= Version(version)


class HoloViews(PaneBase):
"""
`HoloViews` panes render any `HoloViews` object using the
Expand Down Expand Up @@ -487,8 +493,6 @@ def _get_pane(self, backend, state, **kwargs):
return pane_type(state, **kwargs)

def _render(self, doc, comm, root):
import holoviews as hv

from holoviews import Store, renderer as load_renderer

if self.renderer:
Expand Down Expand Up @@ -516,7 +520,7 @@ def _render(self, doc, comm, root):
renderer = renderer.instance(**params)

kwargs = {'margin': self.margin}
if backend == 'bokeh' or Version(str(hv.__version__)) >= Version('1.13.0'):
if backend == 'bokeh' or check_holoviews('1.13.0'):
kwargs['doc'] = doc
kwargs['root'] = root
if comm:
Expand Down Expand Up @@ -807,7 +811,8 @@ def find_links(root_view, root_model):
plots = [(plot, root_plot) for root_plot in root_plots
for plot in root_plot.traverse(lambda x: x, [is_bokeh_element_plot])]

potentials = [(LinkCallback.find_link(plot), root_plot)
link_kwargs = {'target': True} if check_holoviews('1.19') else {}
potentials = [(LinkCallback.find_link(plot, **link_kwargs), root_plot)
for plot, root_plot in plots]

source_links = [p for p in potentials if p[0] is not None]
Expand All @@ -818,7 +823,7 @@ def find_links(root_view, root_model):
# If link has no target don't look further
found.append((link, plot, None))
continue
potentials = [LinkCallback.find_link(plot, link) for plot, inner_root in plots
potentials = [LinkCallback.find_link(plot, link, **link_kwargs) for plot, inner_root in plots
if inner_root is not root_plot]
tgt_links = [p for p in potentials if p is not None]
if tgt_links:
Expand Down
8 changes: 8 additions & 0 deletions panel/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import tempfile
import time
import unittest
import warnings

from contextlib import contextmanager
from subprocess import PIPE, Popen
Expand Down Expand Up @@ -40,6 +41,13 @@
JUPYTER_TIMEOUT = 15 # s
JUPYTER_PROCESS = None

try:
with warnings.catch_warnings():
warnings.filterwarnings("error", category=DeprecationWarning)
asyncio.get_event_loop()
except (RuntimeError, DeprecationWarning):
asyncio.set_event_loop(asyncio.new_event_loop())

def port_open(port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(1)
Expand Down
2 changes: 1 addition & 1 deletion panel/tests/ui/layout/test_feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_feed_view_latest(page):
expect(feed_el).to_have_class("bk-panel-models-feed-Feed scroll-vertical")

# Assert scroll is not at 0 (view_latest)
assert feed_el.evaluate('(el) => el.scrollTop') > 0
wait_until(lambda: feed_el.evaluate('(el) => el.scrollTop') > 0, page)

wait_until(lambda: int(page.locator('pre').last.inner_text()) > 0.9 * ITEMS, page)

Expand Down
2 changes: 1 addition & 1 deletion panel/tests/ui/widgets/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def test_multi_select_double_click(page):

page.locator('option').nth(1).dblclick()

wait_until(lambda: clicks and clicks[0].option == 'B')
wait_until(lambda: bool(clicks) and clicks[0].option == 'B')
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ nbval = "*"
channels = ["pyviz/label/dev", "bokeh", "microsoft", "conda-forge"]

[feature.test-ui.dependencies]
playwright = "*"
playwright = { version = "*", channel = "microsoft" }
pytest-playwright = "*"
jupyter_server = "*"

Expand Down

0 comments on commit c90ffd4

Please sign in to comment.