File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 1515"""Execute Transactions Spec tests."""
1616from __future__ import annotations
1717
18+ import asyncio
1819import sys
1920from io import BytesIO
2021from test .asynchronous .utils_spec_runner import AsyncSpecRunner
@@ -468,6 +469,17 @@ async def callback2(session):
468469 async with self .client .start_session () as s :
469470 self .assertEqual (await s .with_transaction (callback2 ), "Foo" )
470471
472+ @async_client_context .require_transactions
473+ @async_client_context .require_async
474+ async def test_callback_awaitable_no_coroutine (self ):
475+ def callback (_ ):
476+ future = asyncio .Future ()
477+ future .set_result ("Foo" )
478+ return future
479+
480+ async with self .client .start_session () as s :
481+ self .assertEqual (await s .with_transaction (callback ), "Foo" )
482+
471483 @async_client_context .require_transactions
472484 async def test_callback_not_retried_after_timeout (self ):
473485 listener = OvertCommandListener ()
Original file line number Diff line number Diff line change 1515"""Execute Transactions Spec tests."""
1616from __future__ import annotations
1717
18+ import asyncio
1819import sys
1920from io import BytesIO
2021from test .utils_spec_runner import SpecRunner
@@ -460,6 +461,17 @@ def callback2(session):
460461 with self .client .start_session () as s :
461462 self .assertEqual (s .with_transaction (callback2 ), "Foo" )
462463
464+ @client_context .require_transactions
465+ @client_context .require_async
466+ def test_callback_awaitable_no_coroutine (self ):
467+ def callback (_ ):
468+ future = asyncio .Future ()
469+ future .set_result ("Foo" )
470+ return future
471+
472+ with self .client .start_session () as s :
473+ self .assertEqual (s .with_transaction (callback ), "Foo" )
474+
463475 @client_context .require_transactions
464476 def test_callback_not_retried_after_timeout (self ):
465477 listener = OvertCommandListener ()
You can’t perform that action at this time.
0 commit comments