From f2da257b3b931fe82d2f0795d77912aa9dda8b49 Mon Sep 17 00:00:00 2001 From: Andrew Huang Date: Tue, 12 Sep 2023 21:27:55 -0700 Subject: [PATCH] Fix core tests --- holoviews/tests/plotting/matplotlib/test_rasterplot.py | 5 ++++- holoviews/tests/plotting/plotly/test_imagestack.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/holoviews/tests/plotting/matplotlib/test_rasterplot.py b/holoviews/tests/plotting/matplotlib/test_rasterplot.py index f4c73c5258..a7f1f51698 100644 --- a/holoviews/tests/plotting/matplotlib/test_rasterplot.py +++ b/holoviews/tests/plotting/matplotlib/test_rasterplot.py @@ -85,7 +85,10 @@ def test_image_stack(self): c = np.array([[np.nan] * 3, [np.nan] * 3, [1, 1, 1]]) img_stack = ImageStack((x, y, a, b, c), kdims=["x", "y"], vdims=["a", "b", "c"]) - plot = mpl_renderer.get_plot(img_stack) + try: + plot = mpl_renderer.get_plot(img_stack) + except ImportError: + return # Skip test if datashader is unavailable for core tests artist = plot.handles['artist'] array = artist.get_array().data assert array.shape == (3, 3, 4) diff --git a/holoviews/tests/plotting/plotly/test_imagestack.py b/holoviews/tests/plotting/plotly/test_imagestack.py index 138ecded32..9cb7f159af 100644 --- a/holoviews/tests/plotting/plotly/test_imagestack.py +++ b/holoviews/tests/plotting/plotly/test_imagestack.py @@ -14,7 +14,10 @@ def test_image_stack(self): b = np.array([[np.nan] * 3, [1, 1, np.nan], [np.nan] * 3]) c = np.array([[np.nan] * 3, [np.nan] * 3, [1, 1, 1]]) image_stack = ImageStack((x, y, a, b, c), kdims=["x", "y"], vdims=["a", "b", "c"]) - assert isinstance(plotly_renderer.get_plot(image_stack), RGBPlot) + try: + assert isinstance(plotly_renderer.get_plot(image_stack), RGBPlot) + except ImportError: + return # Skip test if datashader is unavailable for core tests fig_dict = plotly_renderer.get_plot_state(image_stack) x_range = fig_dict['layout']['xaxis']['range'] self.assertEqual(x_range[0], -0.5)