Skip to content

Commit 75b79c9

Browse files
authored
chore: Simplify sync_client fixture (#240)
1 parent 3516be5 commit 75b79c9

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/toolbox-core/tests/test_sync_client.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,18 @@ def sync_client_environment():
6767

6868

6969
@pytest.fixture
70-
def sync_client(sync_client_environment, request):
70+
def sync_client(sync_client_environment):
7171
"""
7272
Provides a ToolboxSyncClient instance within an isolated environment.
7373
The client's underlying async session is automatically closed after the test.
7474
The class-level loop/thread are managed by sync_client_environment.
7575
"""
76-
# `sync_client_environment` has prepared the class state.
7776
client = ToolboxSyncClient(TEST_BASE_URL)
7877

79-
def finalizer():
80-
client.close() # Closes the async_client's session.
81-
# Loop/thread shutdown is handled by sync_client_environment's teardown.
78+
yield client
8279

83-
request.addfinalizer(finalizer)
84-
return client
80+
client.close() # Closes the async_client's session.
81+
# Loop/thread shutdown is handled by sync_client_environment's teardown.
8582

8683

8784
@pytest.fixture()

0 commit comments

Comments
 (0)