From 8f60375db4e1440af74fc8b34a0072ef0a6b2919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 7 Sep 2023 10:43:22 +0200 Subject: [PATCH] Add polars to test packages and handle if polars not installed --- hvplot/tests/plotting/testcore.py | 11 ++++++++--- setup.py | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hvplot/tests/plotting/testcore.py b/hvplot/tests/plotting/testcore.py index 67ee561c0..f7f6aa383 100644 --- a/hvplot/tests/plotting/testcore.py +++ b/hvplot/tests/plotting/testcore.py @@ -7,8 +7,13 @@ try: import polars as pl import hvplot.polars # noqa + pl_import = True except ImportError: - pl = None + class pl: + DataFrame = None + LazyFrame = None + Series = None + pl_import = False FRAME_IGNORE_TYPES = {"bivariate", "heatmap", "hexbin", "labels", "vectorfield"} @@ -44,7 +49,7 @@ def test_series_pandas(): -@pytest.mark.skipif(pl is None, reason="polars not installed") +@pytest.mark.skipif(pl_import, reason="polars not installed") @pytest.mark.parametrize("cast", (pl.DataFrame, pl.LazyFrame)) @y_combinations def test_diffent_input_types_polars(y, cast): @@ -56,7 +61,7 @@ def test_diffent_input_types_polars(y, cast): df.hvplot(y=y, kind=t) -@pytest.mark.skipif(pl is None, reason="polars not installed") +@pytest.mark.skipif(pl_import, reason="polars not installed") def test_series_polars(): ser = pl.Series(values=np.random.rand(10), name="A") assert isinstance(ser, pl.Series) diff --git a/setup.py b/setup.py index 0bc3a79cc..c5e627457 100644 --- a/setup.py +++ b/setup.py @@ -60,6 +60,7 @@ def get_setup_version(reponame): 'pooch', 'scipy', 'ipywidgets', + 'polars', ] # Dependencies required to run the notebooks