Skip to content

Commit 411dc79

Browse files
committed
close client in sync test_actor tests
1 parent 5e9e97f commit 411dc79

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

distributed/tests/test_actor.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,7 @@ class UsesCounter:
635635
def do_inc(self, ac):
636636
return ac.increment().result()
637637

638-
with cluster(nworkers=1) as (cl, _):
639-
client = Client(cl["address"])
638+
with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client:
640639
ac = client.submit(Counter, actor=True).result()
641640
ac2 = client.submit(UsesCounter, actor=True).result()
642641

@@ -652,8 +651,7 @@ def do_inc(self, ac):
652651
# cannot expire
653652
return ac.increment().result(timeout=0.001)
654653

655-
with cluster(nworkers=1) as (cl, _):
656-
client = Client(cl["address"])
654+
with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client:
657655
ac = client.submit(Counter, actor=True).result()
658656
ac2 = client.submit(UsesCounter, actor=True).result()
659657

@@ -667,8 +665,7 @@ class UsesCounter:
667665
def do_inc(self, ac):
668666
return get_client().sync(ac.increment)
669667

670-
with cluster(nworkers=1) as (cl, _):
671-
client = Client(cl["address"])
668+
with cluster(nworkers=1) as (cl, _), Client(cl["address"]) as client:
672669
ac = client.submit(Counter, actor=True).result()
673670
ac2 = client.submit(UsesCounter, actor=True).result()
674671

@@ -701,8 +698,7 @@ def method(self):
701698
def prop(self):
702699
raise MyException
703700

704-
with cluster(nworkers=2) as (cl, w):
705-
client = Client(cl["address"])
701+
with cluster(nworkers=2) as (cl, w), Client(cl["address"]) as client:
706702
ac = client.submit(Broken, actor=True).result()
707703
acfut = ac.method()
708704
with pytest.raises(MyException):

0 commit comments

Comments
 (0)