From 89da28ecf9e73a12429a9d482d002f4f148e678d Mon Sep 17 00:00:00 2001 From: Gabe Joseph Date: Tue, 13 Dec 2022 15:36:15 -0700 Subject: [PATCH] less hardcoded test --- distributed/tests/test_scheduler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/distributed/tests/test_scheduler.py b/distributed/tests/test_scheduler.py index 8343917f03..e797eaa6ea 100644 --- a/distributed/tests/test_scheduler.py +++ b/distributed/tests/test_scheduler.py @@ -411,7 +411,8 @@ async def test_queued_release_multiple_workers(c, s, *workers): # All of the second batch should be queued after the first batch assert [ts.key for ts in s.queued.sorted()] == [ - f.key for f in itertools.chain(first_batch[3:], second_batch) + f.key + for f in itertools.chain(first_batch[s.total_nthreads :], second_batch) ] # Cancel the first batch. @@ -424,7 +425,9 @@ async def test_queued_release_multiple_workers(c, s, *workers): await async_wait_for(lambda: len(s.tasks) == len(second_batch), 5) # Second batch should move up the queue and start processing - assert len(s.queued) == len(second_batch) - 3, list(s.queued.sorted()) + assert len(s.queued) == len(second_batch) - s.total_nthreads, list( + s.queued.sorted() + ) await event.set() await c2.gather(second_batch)