Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address PytestReturnNotNoneWarning in cuml tests #5819

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions python/cuml/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -158,8 +158,6 @@ def test_get_tags(model):
else:
assert isinstance(model_tags[tag], tag_type)

return True


def test_dynamic_tags_and_composition():
static_tags = dummy_class_with_tags._get_tags()
Expand Down
13 changes: 9 additions & 4 deletions python/cuml/tests/test_nearest_neighbors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2023, NVIDIA CORPORATION.
# Copyright (c) 2019-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -299,7 +299,7 @@ def test_ivfpq_pred(
if metric in cuml.neighbors.VALID_METRICS[algo]
],
)
def test_ann_distances_metrics(algo, metric):
def test_ann_distances_metrics(algo, metric, request):
X, y = make_blobs(n_samples=500, centers=2, n_features=128, random_state=0)

cu_knn = cuKNN(algorithm=algo, metric=metric)
Expand All @@ -316,8 +316,13 @@ def test_ann_distances_metrics(algo, metric):
sk_dist, sk_ind = sk_knn.kneighbors(
X, n_neighbors=10, return_distance=True
)

return array_equal(sk_dist, cu_dist)
request.applymarker(
pytest.mark.xfail(
not (algo == "brute" and metric in ("cosine", "correlation")),
reason=f"arrays not equal with {algo=} and {metric=}",
)
)
assert bool(array_equal(sk_dist, cu_dist))


def test_return_dists():
Expand Down
Loading