From 411dc7957d36be027cb50e775ef424d04103e18a Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Thu, 26 May 2022 13:50:59 +0100 Subject: [PATCH] close client in sync test_actor tests --- distributed/tests/test_actor.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/distributed/tests/test_actor.py b/distributed/tests/test_actor.py index bd065deb4bf..582180a8869 100644 --- a/distributed/tests/test_actor.py +++ b/distributed/tests/test_actor.py @@ -635,8 +635,7 @@ class UsesCounter: def do_inc(self, ac): return ac.increment().result() - with cluster(nworkers=1) as (cl, _): - client = Client(cl["address"]) + with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client: ac = client.submit(Counter, actor=True).result() ac2 = client.submit(UsesCounter, actor=True).result() @@ -652,8 +651,7 @@ def do_inc(self, ac): # cannot expire return ac.increment().result(timeout=0.001) - with cluster(nworkers=1) as (cl, _): - client = Client(cl["address"]) + with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client: ac = client.submit(Counter, actor=True).result() ac2 = client.submit(UsesCounter, actor=True).result() @@ -667,8 +665,7 @@ class UsesCounter: def do_inc(self, ac): return get_client().sync(ac.increment) - with cluster(nworkers=1) as (cl, _): - client = Client(cl["address"]) + with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client: ac = client.submit(Counter, actor=True).result() ac2 = client.submit(UsesCounter, actor=True).result() @@ -701,8 +698,7 @@ def method(self): def prop(self): raise MyException - with cluster(nworkers=2) as (cl, w): - client = Client(cl["address"]) + with cluster(nworkers=2) as (cl, w), Client(cl["address"]) as client: ac = client.submit(Broken, actor=True).result() acfut = ac.method() with pytest.raises(MyException):