Skip to content

Commit 13b2517

Browse files
committed
remove all seperation of legacy and expression
1 parent ffd7cd0 commit 13b2517

File tree

4 files changed

+5
-141
lines changed

4 files changed

+5
-141
lines changed

holoviews/tests/core/data/test_daskinterface.py

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,18 @@
1313
from holoviews.core.util import PANDAS_VERSION
1414
from holoviews.util.transform import dim
1515

16-
from ...utils import DASK_VERSION, dask_setup, dask_switcher
1716
from .test_pandasinterface import BasePandasInterfaceTests
1817

19-
classic, expr = dask_setup()
2018

21-
22-
class _DaskDatasetTest(BasePandasInterfaceTests):
19+
class DaskDatasetTest(BasePandasInterfaceTests):
2320
"""
2421
Test of the pandas DaskDataset interface.
2522
"""
2623

2724
datatype = 'dask'
25+
data_type = dd.DataFrame
2826

29-
__test__ = False
27+
__test__ = True
3028

3129
# Disabled tests for NotImplemented methods
3230
def test_dataset_add_dimensions_values_hm(self):
@@ -129,43 +127,3 @@ def test_select_expression_lazy(self):
129127
# Make sure that selecting by expression didn't cause evaluation
130128
self.assertIsInstance(new_ds.data, dd.DataFrame)
131129
self.assertEqual(new_ds.data.compute(), df[df.b == 10])
132-
133-
134-
class DaskClassicDatasetTest(_DaskDatasetTest):
135-
136-
# No longer supported from Dask 2025.1
137-
138-
data_type = getattr(dd.core, "DataFrame", None)
139-
140-
__test__ = classic
141-
142-
@dask_switcher(query=False)
143-
def setUp(self):
144-
return super().setUp()
145-
146-
147-
class DaskExprDatasetTest(_DaskDatasetTest):
148-
149-
__test__ = expr
150-
151-
@property
152-
def data_type(self):
153-
# Only available from 2025.1 and forward
154-
if DASK_VERSION >= (2025, 1, 0):
155-
return dd.DataFrame
156-
else:
157-
import dask_expr
158-
159-
return dask_expr.DataFrame
160-
161-
@dask_switcher(query=True)
162-
def setUp(self):
163-
return super().setUp()
164-
165-
def test_dataset_groupby(self):
166-
# Dask-expr unique sort the order when running unique on column
167-
super().test_dataset_groupby(sort=True)
168-
169-
def test_dataset_groupby_alias(self):
170-
# Dask-expr unique sort the order when running unique on column
171-
super().test_dataset_groupby_alias(sort=True)

holoviews/tests/core/data/test_spatialpandas.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
from holoviews.element import Path, Points, Polygons
3434
from holoviews.element.comparison import ComparisonTestCase
3535

36-
from ...utils import dask_switcher
3736
from .test_multiinterface import GeomTests
3837

3938

@@ -249,7 +248,7 @@ def test_geometry_array_constructor(self):
249248
self.assertIsInstance(path.data.geometry.dtype, MultiPolygonDtype)
250249

251250

252-
class DaskSpatialPandasBaseTest(GeomTests, RoundTripTests):
251+
class DaskSpatialPandasTest(GeomTests, RoundTripTests):
253252
"""
254253
Test of the DaskSpatialPandasInterface.
255254
"""
@@ -258,7 +257,7 @@ class DaskSpatialPandasBaseTest(GeomTests, RoundTripTests):
258257

259258
interface = DaskSpatialPandasInterface
260259

261-
__test__ = False
260+
__test__ = True
262261

263262
def setUp(self):
264263
if spatialpandas is None:
@@ -302,26 +301,3 @@ def test_dict_dataset_add_dimension_values(self):
302301

303302
def test_sort_by_value(self):
304303
raise SkipTest("Not supported")
305-
306-
307-
class DaskSpatialPandasClassicTest(DaskSpatialPandasBaseTest):
308-
"""
309-
Test of the Classic DaskSpatialPandasInterface, no longer exits since dask 2025.1
310-
"""
311-
312-
__test__ = True
313-
314-
@dask_switcher(query=False, extras=["spatialpandas.dask"])
315-
def setUp(self):
316-
super().setUp()
317-
318-
class DaskSpatialPandasExprTest(DaskSpatialPandasBaseTest):
319-
"""
320-
Test of the Classic DaskSpatialPandasInterface, no longer exits since dask 2025.1
321-
"""
322-
323-
__test__ = True
324-
325-
@dask_switcher(query=True, extras=["spatialpandas.dask"])
326-
def setUp(self):
327-
super().setUp()

holoviews/tests/utils.py

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import logging
22
import os
33
import sys
4-
from contextlib import contextmanager, suppress
5-
from functools import lru_cache
6-
from importlib import reload
7-
from importlib.util import find_spec
84

95
import param
10-
import pytest
116

12-
from holoviews.core.util import _no_import_version
137
from holoviews.element.comparison import ComparisonTestCase
148

159
cwd = os.path.abspath(os.path.split(__file__)[0])
@@ -117,64 +111,3 @@ def tearDown(self):
117111
for level, msgs in messages.items():
118112
for msg in msgs:
119113
log.log(LEVELS[level], msg)
120-
121-
122-
DASK_UNAVAILABLE = find_spec("dask") is None
123-
DASK_VERSION = _no_import_version("dask")
124-
125-
126-
@lru_cache
127-
def dask_setup():
128-
"""
129-
Set-up both dask dataframes, using lru_cahce to only do it once
130-
131-
"""
132-
from datashader.data_libraries.dask import bypixel, dask_pipeline
133-
134-
classic, expr = False, False
135-
136-
# Removed in Dask 2025.1, and will raise AttributeError
137-
if DASK_VERSION < (2025, 1, 0):
138-
import dask.dataframe as dd
139-
140-
bypixel.pipeline.register(dd.core.DataFrame)(dask_pipeline)
141-
classic = True
142-
else:
143-
# dask_expr import below will now fail with:
144-
# cannot import name '_Frame' from 'dask.dataframe.core'
145-
expr = True
146-
147-
with suppress(ImportError):
148-
import dask_expr
149-
150-
bypixel.pipeline.register(dask_expr.DataFrame)(dask_pipeline)
151-
expr = True
152-
153-
return classic, expr
154-
155-
156-
@contextmanager
157-
def dask_switcher(*, query=False, extras=None):
158-
"""
159-
Context manager to switch on/off dask-expr query planning.
160-
161-
Using a context manager as it is an easy way to
162-
change the function to a decorator.
163-
"""
164-
if DASK_UNAVAILABLE:
165-
pytest.skip("dask is not available")
166-
167-
classic, expr = dask_setup()
168-
169-
if not query and not classic:
170-
pytest.skip("Classic DataFrame no longer supported by dask")
171-
if query and not expr:
172-
pytest.skip("dask-expr is not available")
173-
174-
import dask
175-
176-
dask.config.set(**{"dataframe.query-planning": query})
177-
for module in ("dask.dataframe", *(extras or ())):
178-
if module in sys.modules:
179-
reload(sys.modules[module])
180-
yield

pixi.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ PYTHONIOENCODING = "utf-8"
8282
python = "3.9.*"
8383
panel = "1.4.*"
8484

85-
[feature.py39.activation.env]
86-
DASK_DATAFRAME__QUERY_PLANNING = "False"
87-
8885
[feature.py310.dependencies]
8986
python = "3.10.*"
9087
bokeh_sampledata = "*"

0 commit comments

Comments
 (0)