From c8fe0465658c927d6f453eb3cc141ce3f39f4b1a Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 13 Oct 2022 10:49:18 +0100 Subject: [PATCH] Filter implicit deprecation warnings from tornado as well tornado 6.2 deprecates functionality that relies on deprecated asyncio calls (get_event_loop and friends); a few tests still use a pattern of implicitly creating a new loop (and test that appropriate deprecation warnings are uttered), so just catch these new tornado warnings for now, until the functionality is removed in distributed. --- distributed/deploy/tests/test_adaptive.py | 1 + distributed/deploy/tests/test_spec_cluster.py | 1 + distributed/tests/test_client.py | 4 ++++ distributed/tests/test_client_loop.py | 2 ++ distributed/tests/test_utils.py | 2 ++ 5 files changed, 10 insertions(+) diff --git a/distributed/deploy/tests/test_adaptive.py b/distributed/deploy/tests/test_adaptive.py index 31dcd7b4459..36b3198d8b5 100644 --- a/distributed/deploy/tests/test_adaptive.py +++ b/distributed/deploy/tests/test_adaptive.py @@ -281,6 +281,7 @@ async def test_no_more_workers_than_tasks(): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_basic_no_loop(cleanup): loop = None try: diff --git a/distributed/deploy/tests/test_spec_cluster.py b/distributed/deploy/tests/test_spec_cluster.py index 31b95e28026..e0e7301fcf8 100644 --- a/distributed/deploy/tests/test_spec_cluster.py +++ b/distributed/deploy/tests/test_spec_cluster.py @@ -83,6 +83,7 @@ def test_spec_sync(loop): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_loop_started_in_constructor(cleanup): # test that SpecCluster.__init__ starts a loop in another thread cluster = SpecCluster(worker_spec, scheduler=scheduler, loop=None) diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py index 958e3e68eea..b5cb7fc1b31 100644 --- a/distributed/tests/test_client.py +++ b/distributed/tests/test_client.py @@ -2889,6 +2889,7 @@ async def test_startup_close_startup(s, a, b): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_startup_close_startup_sync(loop): with cluster() as (s, [a, b]): with Client(s["address"], loop=loop) as c: @@ -5613,6 +5614,8 @@ async def test_future_auto_inform(c, s, a, b): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:clear_current is deprecated:DeprecationWarning") def test_client_async_before_loop_starts(cleanup): async def close(): async with client: @@ -6924,6 +6927,7 @@ async def test_workers_collection_restriction(c, s, a, b): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") @gen_cluster(client=True, nthreads=[("127.0.0.1", 1)]) async def test_get_client_functions_spawn_clusters(c, s, a): # see gh4565 diff --git a/distributed/tests/test_client_loop.py b/distributed/tests/test_client_loop.py index 35bb3a7e861..9d8316cdd09 100644 --- a/distributed/tests/test_client_loop.py +++ b/distributed/tests/test_client_loop.py @@ -30,6 +30,7 @@ def _check_cluster_and_client_loop(loop): # Test if Client stops LoopRunner on close. @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_close_loop_sync_start_new_loop(cleanup): with _check_loop_runner(): _check_cluster_and_client_loop(loop=None) @@ -37,6 +38,7 @@ def test_close_loop_sync_start_new_loop(cleanup): # Test if Client stops LoopRunner on close. @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_close_loop_sync_use_running_loop(cleanup): with _check_loop_runner(): # Start own loop or use current thread's one. diff --git a/distributed/tests/test_utils.py b/distributed/tests/test_utils.py index 853ba578f11..b2dae76fdb2 100644 --- a/distributed/tests/test_utils.py +++ b/distributed/tests/test_utils.py @@ -405,6 +405,7 @@ def assert_not_running(loop): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_loop_runner(loop_in_thread): # Implicit loop loop = IOLoop() @@ -488,6 +489,7 @@ def test_loop_runner(loop_in_thread): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_two_loop_runners(loop_in_thread): # Loop runners tied to the same loop should cooperate