@@ -48,7 +48,7 @@ async def __aenter__(self):
48
48
self .parent .did_it = 1
49
49
if sys .version_info >= (3 , 7 ):
50
50
assert sniffio .current_async_library () == "asyncio"
51
- await asyncio .sleep (0.01 )
51
+ await asyncio .sleep (0.01 , loop = self . loop )
52
52
self .parent .did_it = 2
53
53
return self
54
54
@@ -83,7 +83,7 @@ async def call_a_ts(self, proc, *args, loop=None):
83
83
@pytest .mark .trio
84
84
async def test_call_at (self , loop ):
85
85
async def delay (t ):
86
- done = asyncio .Event ()
86
+ done = asyncio .Event (loop = loop )
87
87
loop .call_at (t , done .set )
88
88
await done .wait ()
89
89
@@ -193,7 +193,7 @@ def dly_trio(seen):
193
193
@pytest .mark .trio
194
194
async def test_trio_asyncio (self , loop ):
195
195
async def dly_asyncio (seen ):
196
- await asyncio .sleep (0.01 )
196
+ await asyncio .sleep (0.01 , loop = loop )
197
197
seen .flag |= 1
198
198
return 4
199
199
@@ -280,7 +280,7 @@ def err_trio_sync():
280
280
@pytest .mark .trio
281
281
async def test_trio_asyncio_error (self , loop ):
282
282
async def err_asyncio ():
283
- await asyncio .sleep (0.01 )
283
+ await asyncio .sleep (0.01 , loop = loop )
284
284
raise RuntimeError ("I has an owie" )
285
285
286
286
with pytest .raises (RuntimeError ) as err :
@@ -317,14 +317,14 @@ async def cancelled_trio(seen):
317
317
async def test_trio_asyncio_cancel_out (self , loop ):
318
318
async def cancelled_asyncio (seen ):
319
319
seen .flag |= 1
320
- await asyncio .sleep (0.01 )
321
- f = asyncio .Future ()
320
+ await asyncio .sleep (0.01 , loop = loop )
321
+ f = asyncio .Future (loop = loop )
322
322
f .cancel ()
323
323
return f .result () # raises error
324
324
325
325
def cancelled_future (seen ):
326
326
seen .flag |= 1
327
- f = asyncio .Future ()
327
+ f = asyncio .Future (loop = loop )
328
328
f .cancel ()
329
329
return f # contains error
330
330
@@ -387,7 +387,7 @@ async def in_trio(started, seen):
387
387
seen .flag |= 2
388
388
389
389
async def cancel_asyncio (seen ):
390
- started = asyncio .Event ()
390
+ started = asyncio .Event (loop = loop )
391
391
f = asyncio .ensure_future (self .call_a_t (in_trio , started , seen , loop = loop ))
392
392
await started .wait ()
393
393
f .cancel ()
@@ -404,7 +404,7 @@ async def test_trio_asyncio_cancel_in(self, loop):
404
404
async def in_asyncio (started , seen ):
405
405
started .set ()
406
406
try :
407
- await asyncio .sleep (9999 )
407
+ await asyncio .sleep (9999 , loop = loop )
408
408
except asyncio .CancelledError :
409
409
seen .flag |= 1
410
410
except trio .Cancelled :
@@ -527,7 +527,7 @@ def err_asyncio():
527
527
async def test_trio_asyncio_generator (self , loop ):
528
528
async def dly_asyncio ():
529
529
yield 1
530
- await asyncio .sleep (0.01 )
530
+ await asyncio .sleep (0.01 , loop = loop )
531
531
yield 2
532
532
533
533
with test_utils .deprecate (self ):
@@ -557,7 +557,7 @@ async def cancel_soon(nursery):
557
557
await trio .sleep (0.01 )
558
558
nursery .cancel_scope .cancel ()
559
559
560
- hold = asyncio .Event ()
560
+ hold = asyncio .Event (loop = loop )
561
561
seen = Seen ()
562
562
563
563
with test_utils .deprecate (self ):
@@ -571,7 +571,7 @@ async def cancel_soon(nursery):
571
571
async def test_trio_asyncio_iterator (self , loop ):
572
572
async def slow_nums ():
573
573
for n in range (1 , 6 ):
574
- await asyncio .sleep (0.01 )
574
+ await asyncio .sleep (0.01 , loop = loop )
575
575
yield n
576
576
577
577
sum = 0
@@ -583,7 +583,7 @@ async def slow_nums():
583
583
async def test_trio_asyncio_iterator_depr (self , loop ):
584
584
async def slow_nums ():
585
585
for n in range (1 , 6 ):
586
- await asyncio .sleep (0.01 )
586
+ await asyncio .sleep (0.01 , loop = loop )
587
587
yield n
588
588
589
589
sum = 0
0 commit comments