Skip to content

Commit 6a1352d

Browse files
committed
Don't close client when skipping sync tests
1 parent 00546d1 commit 6a1352d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

test/asynchronous/unified_format.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,10 @@ async def asyncSetUp(self):
498498
# process file-level runOnRequirements
499499
run_on_spec = self.TEST_SPEC.get("runOnRequirements", [])
500500
if not await self.should_run_on(run_on_spec):
501-
await self.client.close()
501+
# Explicitly close async clients here
502+
# to prevent leaky monitor tasks
503+
if not _IS_SYNC:
504+
await async_client_context.client.close()
502505
raise unittest.SkipTest(f"{self.__class__.__name__} runOnRequirements not satisfied")
503506

504507
# add any special-casing for skipping tests here

test/unified_format.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,10 @@ def setUp(self):
497497
# process file-level runOnRequirements
498498
run_on_spec = self.TEST_SPEC.get("runOnRequirements", [])
499499
if not self.should_run_on(run_on_spec):
500-
self.client.close()
500+
# Explicitly close async clients here
501+
# to prevent leaky monitor tasks
502+
if not _IS_SYNC:
503+
client_context.client.close()
501504
raise unittest.SkipTest(f"{self.__class__.__name__} runOnRequirements not satisfied")
502505

503506
# add any special-casing for skipping tests here

0 commit comments

Comments
 (0)