Skip to content

Commit

Permalink
Enable pytest failures on FutureWarnings/DeprecationWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Mar 14, 2024
1 parent c52ca52 commit ece0f9d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions python/cuml/internals/import_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import platform

from cuml.internals.safe_imports import gpu_only_import, UnavailableError
from distutils.version import LooseVersion
from packaging.version import Version


numba = gpu_only_import("numba")
Expand Down Expand Up @@ -123,14 +123,14 @@ def check_min_dask_version(version):
try:
import dask

return LooseVersion(dask.__version__) >= LooseVersion(version)
return Version(dask.__version__) >= Version(version)
except ImportError:
return False


def check_min_numba_version(version):
try:
return LooseVersion(str(numba.__version__)) >= LooseVersion(version)
return Version(str(numba.__version__)) >= Version(version)
except UnavailableError:
return False

Expand All @@ -139,7 +139,7 @@ def check_min_cupy_version(version):
if has_cupy():
import cupy

return LooseVersion(str(cupy.__version__)) >= LooseVersion(version)
return Version(str(cupy.__version__)) >= Version(version)
else:
return False

Expand Down Expand Up @@ -186,7 +186,7 @@ def has_shap(min_version="0.37"):
if min_version is None:
return True
else:
return LooseVersion(str(shap.__version__)) >= LooseVersion(
return Version(str(shap.__version__)) >= Version(
min_version
)
except ImportError:
Expand All @@ -200,7 +200,7 @@ def has_daskglm(min_version=None):
if min_version is None:
return True
else:
return LooseVersion(str(dask_glm.__version__)) >= LooseVersion(
return Version(str(dask_glm.__version__)) >= Version(
min_version
)
except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions python/cuml/tests/dask/test_dask_one_hot_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_onehot_vs_skonehot(client):
X = dask_cudf.from_cudf(X, npartitions=2)

enc = OneHotEncoder(sparse=False)
skohe = SkOneHotEncoder(sparse=False)
skohe = SkOneHotEncoder(sparse_output=False)

ohe = enc.fit_transform(X)
ref = skohe.fit_transform(skX)
Expand Down Expand Up @@ -141,7 +141,7 @@ def test_onehot_random_inputs(client, drop, as_array, sparse, n_samples):
dX = dask_cudf.from_cudf(X, npartitions=1)

enc = OneHotEncoder(sparse=sparse, drop=drop, categories="auto")
sk_enc = SkOneHotEncoder(sparse=sparse, drop=drop, categories="auto")
sk_enc = SkOneHotEncoder(sparse_output=sparse, drop=drop, categories="auto")
ohe = enc.fit_transform(dX)
ref = sk_enc.fit_transform(ary)
if sparse:
Expand All @@ -160,7 +160,7 @@ def test_onehot_drop_idx_first(client):
ddf = dask_cudf.from_cudf(X, npartitions=2)

enc = OneHotEncoder(sparse=False, drop="first")
sk_enc = SkOneHotEncoder(sparse=False, drop="first")
sk_enc = SkOneHotEncoder(sparse_output=False, drop="first")
ohe = enc.fit_transform(ddf)
ref = sk_enc.fit_transform(X_ary)
cp.testing.assert_array_equal(ohe.compute(), ref)
Expand All @@ -178,7 +178,7 @@ def test_onehot_drop_one_of_each(client):

drop = dict({"chars": "b", "int": 2, "letters": "b"})
enc = OneHotEncoder(sparse=False, drop=drop)
sk_enc = SkOneHotEncoder(sparse=False, drop=["b", 2, "b"])
sk_enc = SkOneHotEncoder(sparse_output=False, drop=["b", 2, "b"])
ohe = enc.fit_transform(ddf)
ref = sk_enc.fit_transform(X_ary)
cp.testing.assert_array_equal(ohe.compute(), ref)
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/tests/dask/test_dask_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_serialize_mnmg_model(client):
X, y = make_regression(n_samples=1000, n_features=20, random_state=0)
X, y = da.from_array(X), da.from_array(y)

model = LinearRegression(client)
model = LinearRegression(client=client)
model.fit(X, y)

pickled_model = pickle.dumps(model)
Expand Down
3 changes: 2 additions & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ markers = [
testpaths = "cuml/tests"

filterwarnings = [
"error::FutureWarning:cuml[.*]", # Catch uses of deprecated positional args in testing
"error::FutureWarning",
"error::DeprecationWarning",
"error:::cudf",
"ignore:[^.]*ABCs[^.]*:DeprecationWarning:patsy[.*]",
"ignore:(.*)alias(.*):DeprecationWarning:hdbscan[.*]",
Expand Down

0 comments on commit ece0f9d

Please sign in to comment.