MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / test_mixed_sync_async_calls

Function test_mixed_sync_async_calls

sdk/python/tests/test_client.py:632–647  ·  view source on GitHub ↗

Test mixing sync and async client calls in the same async context.

()

Source from the content-addressed store, hash-verified

630
631@pytest.mark.asyncio
632async def test_mixed_sync_async_calls():
633 """Test mixing sync and async client calls in the same async context."""
634 sync_client = DstackClient()
635 async_client = AsyncDstackClient()
636
637 # Call sync client from async context
638 sync_result = sync_client.get_key()
639 assert isinstance(sync_result, GetKeyResponse)
640
641 # Call async client normally
642 async_result = await async_client.get_key()
643 assert isinstance(async_result, GetKeyResponse)
644
645 # Both should work and return valid results
646 assert len(sync_result.decode_key()) == 32
647 assert len(async_result.decode_key()) == 32

Callers

nothing calls this directly

Calls 5

get_keyMethod · 0.95
get_keyMethod · 0.95
DstackClientClass · 0.90
AsyncDstackClientClass · 0.90
decode_keyMethod · 0.45

Tested by

no test coverage detected