Skip to content

chore: Simplify sync_client fixture #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/toolbox-core/tests/test_sync_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,18 @@ def sync_client_environment():


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

def finalizer():
client.close() # Closes the async_client's session.
# Loop/thread shutdown is handled by sync_client_environment's teardown.
yield client

request.addfinalizer(finalizer)
return client
client.close() # Closes the async_client's session.
# Loop/thread shutdown is handled by sync_client_environment's teardown.


@pytest.fixture()
Expand Down