Skip to content

Commit

Permalink
fix test_worker.py::test_io_loop_alternate_loop and test_scheduler.py…
Browse files Browse the repository at this point in the history
…::test_io_loop
  • Loading branch information
graingert committed Jul 6, 2023
1 parent cfe4326 commit 397bbb2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
16 changes: 7 additions & 9 deletions distributed/tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1365,15 +1365,13 @@ async def test_update_graph_culls(s, a, b):
assert "z" not in s.tasks


def test_io_loop(loop):
async def main():
with pytest.warns(
DeprecationWarning, match=r"the loop kwarg to Scheduler is deprecated"
):
s = Scheduler(loop=loop, dashboard_address=":0", validate=True)
assert s.io_loop is IOLoop.current()

asyncio.run(main())
@gen_test()
async def test_io_loop(loop):
with pytest.warns(
DeprecationWarning, match=r"the loop kwarg to Scheduler is deprecated"
):
s = Scheduler(loop=loop, dashboard_address=":0", validate=True)
assert s.io_loop is IOLoop.current()


@gen_cluster(client=True)
Expand Down
17 changes: 7 additions & 10 deletions distributed/tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,16 +592,13 @@ async def test_io_loop(s):

@gen_cluster(nthreads=[])
async def test_io_loop_alternate_loop(s, loop):
async def main():
with pytest.warns(
DeprecationWarning,
match=r"The `loop` argument to `Worker` is ignored, and will be "
r"removed in a future release. The Worker always binds to the current loop",
):
async with Worker(s.address, loop=loop) as w:
assert w.io_loop is w.loop is IOLoop.current()

await asyncio.to_thread(asyncio.run, main())
with pytest.warns(
DeprecationWarning,
match=r"The `loop` argument to `Worker` is ignored, and will be "
r"removed in a future release. The Worker always binds to the current loop",
):
async with Worker(s.address, loop=loop) as w:
assert w.io_loop is w.loop is IOLoop.current()


@gen_cluster(client=True)
Expand Down

0 comments on commit 397bbb2

Please sign in to comment.