Skip to content

Commit

Permalink
Change how warnings are captured and asserted in test_no_empty_slice_…
Browse files Browse the repository at this point in the history
…warning
  • Loading branch information
milesgranger committed Mar 4, 2024
1 parent f6554fa commit 73014db
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_pca.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import warnings
from itertools import product

import dask.array as da
Expand Down Expand Up @@ -103,7 +104,6 @@ def test_pca_randomized_solver():
)


@pytest.mark.skip(reason="Passing None has been deprecated")
def test_no_empty_slice_warning():
if not DASK_2_26_0:
# See https://github.com/dask/dask/pull/6591
Expand All @@ -114,7 +114,8 @@ def test_no_empty_slice_warning():
X = np.random.uniform(-1, 1, size=(n_components, n_features))
dX = da.from_array(X, chunks=(n_components, n_features))
pca = dd.PCA(n_components=n_components)
with pytest.warns(None) as w:

with warnings.catch_warnings(record=True) as w:
pca.fit(dX)

assert len(w) == 0
Expand Down

0 comments on commit 73014db

Please sign in to comment.