Skip to content

Commit 10bb0a7

Browse files
authored
[backport] [CI] Skip pyspark sparse tests. (dmlc#8675) (dmlc#8678)
1 parent e803d06 commit 10bb0a7

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

tests/ci_build/conda_env/cpu_test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ dependencies:
3636
- cloudpickle
3737
- shap
3838
- modin
39+
# TODO: Replace it with pyspark>=3.4 once 3.4 released.
40+
# - https://ml-team-public-read.s3.us-west-2.amazonaws.com/pyspark-3.4.0.dev0.tar.gz
41+
- pyspark>=3.3.1
3942
- pip:
4043
- datatable
41-
# TODO: Replace it with pyspark>=3.4 once 3.4 released.
42-
- https://ml-team-public-read.s3.us-west-2.amazonaws.com/pyspark-3.4.0.dev0.tar.gz

tests/python/test_spark/test_spark_local.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@
4141
pytestmark = testing.timeout(60)
4242

4343

44+
def no_sparse_unwrap():
45+
try:
46+
from pyspark.sql.functions import unwrap_udt
47+
48+
except ImportError:
49+
return {"reason": "PySpark<3.4", "condition": True}
50+
51+
return {"reason": "PySpark<3.4", "condition": False}
52+
53+
4454
class XgboostLocalTest(SparkTestCase):
4555
def setUp(self):
4656
logging.getLogger().setLevel("INFO")
@@ -985,6 +995,7 @@ def test_classifier_with_feature_names_types_weights(self):
985995
model = classifier.fit(self.cls_df_train)
986996
model.transform(self.cls_df_test).collect()
987997

998+
@pytest.mark.skipif(**no_sparse_unwrap())
988999
def test_regressor_with_sparse_optim(self):
9891000
regressor = SparkXGBRegressor(missing=0.0)
9901001
model = regressor.fit(self.reg_df_sparse_train)
@@ -1001,6 +1012,7 @@ def test_regressor_with_sparse_optim(self):
10011012
for row1, row2 in zip(pred_result, pred_result2):
10021013
self.assertTrue(np.isclose(row1.prediction, row2.prediction, atol=1e-3))
10031014

1015+
@pytest.mark.skipif(**no_sparse_unwrap())
10041016
def test_classifier_with_sparse_optim(self):
10051017
cls = SparkXGBClassifier(missing=0.0)
10061018
model = cls.fit(self.cls_df_sparse_train)

0 commit comments

Comments
 (0)