From d067747824cdfd45cb1a9f23488f443f3a1c9b08 Mon Sep 17 00:00:00 2001 From: Kurt McKee Date: Tue, 23 Jul 2024 08:14:45 -0500 Subject: [PATCH] Catch a known `DeprecationWarning` when calling `.close()` --- tests/test_asyncio/test_cluster.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_asyncio/test_cluster.py b/tests/test_asyncio/test_cluster.py index c16272bb5b..fefa4ef8f9 100644 --- a/tests/test_asyncio/test_cluster.py +++ b/tests/test_asyncio/test_cluster.py @@ -313,7 +313,8 @@ async def mock_aclose(): called += 1 with mock.patch.object(cluster, "aclose", mock_aclose): - await cluster.close() + with pytest.warns(DeprecationWarning, match=r"Use aclose\(\) instead"): + await cluster.close() assert called == 1 await cluster.aclose()