Skip to content

Commit 5bd164b

Browse files
committed
tests: fix no longer supported use of pytest.warns(None)
pytest.warns(None) should be replaced with ensuring no warnings in another way using the standard lib warnings.
1 parent da9f52a commit 5bd164b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tests/test_client.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
22
import time
3+
import warnings
34

45
import aiohttp
56
import dask
@@ -409,19 +410,17 @@ def test():
409410

410411
def test_cleanup():
411412
# No warnings raised by cleanup function
412-
with pytest.warns(UserWarning) as rec:
413+
with warnings.catch_warnings():
414+
warnings.simplefilter("error", UserWarning)
413415
cleanup_lingering_clusters()
414-
for r in rec:
415-
assert not issubclass(r.category, UserWarning)
416416

417417
# Cluster is now closed
418418
assert cluster.status == "closed"
419419

420420
# No harm in double running
421-
with pytest.warns(UserWarning) as rec:
421+
with warnings.catch_warnings():
422+
warnings.simplefilter("error", UserWarning)
422423
cleanup_lingering_clusters()
423-
for r in rec:
424-
assert not issubclass(r.category, UserWarning)
425424

426425
await loop.run_in_executor(None, test_cleanup)
427426

0 commit comments

Comments
 (0)