File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,23 @@ async def run_trio_asyncio_future(self, loop):
223
223
async def test_trio_asyncio_future (self , loop ):
224
224
await allow_asyncio (self .run_trio_asyncio_future , loop )
225
225
226
+ def get_asyncio_future (self , loop , sth ):
227
+ async def set_result (future , sth ):
228
+ await asyncio .sleep (0.01 )
229
+ sth .flag |= 1
230
+ future .set_result (4 )
231
+
232
+ f = loop .create_future ()
233
+ loop .create_task (set_result (f , sth ))
234
+ return f
235
+
236
+ @pytest .mark .trio
237
+ async def test_trio_asyncio_future_getter (self , loop ):
238
+ sth = SomeThing (loop )
239
+ res = await allow_asyncio (self .get_asyncio_future , loop , sth )
240
+ assert res == 4
241
+ assert sth .flag == 1
242
+
226
243
async def run_trio_asyncio_adapted (self , loop ):
227
244
sth = SomeThing (loop )
228
245
res = await sth .dly_asyncio_adapted ()
You can’t perform that action at this time.
0 commit comments