diff --git a/distributed/utils_test.py b/distributed/utils_test.py index 3b46a9b6a2a..ad574f5a46f 100644 --- a/distributed/utils_test.py +++ b/distributed/utils_test.py @@ -56,6 +56,7 @@ from distributed.nanny import Nanny from distributed.node import ServerNode from distributed.proctitle import enable_proctitle_on_children +from distributed.profile import wait_profiler from distributed.protocol import deserialize from distributed.security import Security from distributed.utils import ( @@ -1782,7 +1783,9 @@ def check_instances(): sleep(0.1) assert time() < start + 10 - _global_clients.clear() + wait_profiler() + gc.collect() + assert not Nanny._instances for w in Worker._instances: with suppress(RuntimeError): # closed IOLoop @@ -1807,18 +1810,12 @@ def check_instances(): Comm._instances.clear() raise ValueError("Unclosed Comms", L) - assert all( - n.status in {Status.closed, Status.init, Status.failed} - for n in Nanny._instances - ), {n: n.status for n in Nanny._instances} - # assert not list(SpecCluster._instances) # TODO assert all(c.status == Status.closed for c in SpecCluster._instances), list( SpecCluster._instances ) SpecCluster._instances.clear() - Nanny._instances.clear() DequeHandler.clear_all_instances()