Skip to content

Commit

Permalink
Add polars to test packages and handle if polars not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Sep 7, 2023
1 parent 638b509 commit 8f60375
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hvplot/tests/plotting/testcore.py
Expand Up @@ -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"}
Expand Down Expand Up @@ -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):
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Expand Up @@ -60,6 +60,7 @@ def get_setup_version(reponame):
'pooch',
'scipy',
'ipywidgets',
'polars',
]

# Dependencies required to run the notebooks
Expand Down

0 comments on commit 8f60375

Please sign in to comment.