@@ -48,7 +48,7 @@ async def __aenter__(self):
4848 self .parent .did_it = 1
4949 if sys .version_info >= (3 , 7 ):
5050 assert sniffio .current_async_library () == "asyncio"
51- await asyncio .sleep (0.01 , loop = self . loop )
51+ await asyncio .sleep (0.01 )
5252 self .parent .did_it = 2
5353 return self
5454
@@ -60,7 +60,7 @@ async def __aexit__(self, *tb):
6060class TestCalls (aiotest .TestCase ):
6161 async def call_t_a (self , proc , * args , loop = None ):
6262 """called from Trio"""
63- return await aio_as_trio (proc , loop = loop )(* args )
63+ return await aio_as_trio (proc )(* args )
6464
6565 async def call_t_a_depr (self , proc , * args , loop = None ):
6666 """called from Trio"""
@@ -69,7 +69,7 @@ async def call_t_a_depr(self, proc, *args, loop=None):
6969
7070 async def call_a_t (self , proc , * args , loop = None ):
7171 """call from asyncio to an async trio function"""
72- return await trio_as_aio (proc , loop = loop )(* args )
72+ return await trio_as_aio (proc )(* args )
7373
7474 async def call_a_t_depr (self , proc , * args , loop = None ):
7575 """call from asyncio to an async trio function"""
@@ -83,17 +83,17 @@ async def call_a_ts(self, proc, *args, loop=None):
8383 @pytest .mark .trio
8484 async def test_call_at (self , loop ):
8585 async def delay (t ):
86- done = asyncio .Event (loop = loop )
86+ done = asyncio .Event ()
8787 loop .call_at (t , done .set )
8888 await done .wait ()
8989
9090 t = loop .time () + 0.1
91- await aio_as_trio (delay , loop = loop )(t )
91+ await aio_as_trio (delay )(t )
9292
9393 @pytest .mark .trio
9494 async def test_call_at_depr (self , loop ):
9595 async def delay (t ):
96- done = asyncio .Event (loop = loop )
96+ done = asyncio .Event ()
9797 loop .call_at (t , done .set )
9898 await done .wait ()
9999
@@ -111,7 +111,7 @@ async def dly_trio(seen):
111111 return 8
112112
113113 seen = Seen ()
114- res = await aio_as_trio (partial (self .call_a_t , loop = loop ), loop = loop )(dly_trio , seen )
114+ res = await aio_as_trio (partial (self .call_a_t , loop = loop ))(dly_trio , seen )
115115 assert res == 8
116116 assert seen .flag == 2
117117
@@ -125,14 +125,14 @@ async def dly_trio(seen):
125125 return 8
126126
127127 seen = Seen ()
128- res = await aio_as_trio (partial (self .call_a_t_depr , loop = loop ), loop = loop )(dly_trio , seen )
128+ res = await aio_as_trio (partial (self .call_a_t_depr , loop = loop ))(dly_trio , seen )
129129 assert res == 8
130130 assert seen .flag == 2
131131
132132 @pytest .mark .trio
133133 async def test_call_asyncio_ctx (self , loop ):
134134 self .did_it = 0
135- async with aio_as_trio (AioContext (self , loop ), loop = loop ) as ctx :
135+ async with aio_as_trio (AioContext (self , loop )) as ctx :
136136 assert ctx .parent is self
137137 assert self .did_it == 2
138138 self .did_it = 3
@@ -148,7 +148,7 @@ async def _call_trio_ctx():
148148 self .did_it = 3
149149 assert self .did_it == 4
150150
151- await aio_as_trio (_call_trio_ctx , loop = loop )()
151+ await aio_as_trio (_call_trio_ctx )()
152152
153153 @pytest .mark .trio
154154 async def test_call_trio_ctx_depr (self , loop ):
@@ -172,7 +172,7 @@ def dly_trio(seen):
172172 return 8
173173
174174 seen = Seen ()
175- res = await aio_as_trio (partial (self .call_a_ts , loop = loop ), loop = loop )(dly_trio , seen )
175+ res = await aio_as_trio (partial (self .call_a_ts , loop = loop ))(dly_trio , seen )
176176 assert res == 8
177177 assert seen .flag == 2
178178
@@ -193,7 +193,7 @@ def dly_trio(seen):
193193 @pytest .mark .trio
194194 async def test_trio_asyncio (self , loop ):
195195 async def dly_asyncio (seen ):
196- await asyncio .sleep (0.01 , loop = loop )
196+ await asyncio .sleep (0.01 )
197197 seen .flag |= 1
198198 return 4
199199
@@ -205,7 +205,7 @@ async def dly_asyncio(seen):
205205 @pytest .mark .trio
206206 async def test_trio_asyncio_depr (self , loop ):
207207 async def dly_asyncio (seen ):
208- await asyncio .sleep (0.01 , loop = loop )
208+ await asyncio .sleep (0.01 )
209209 seen .flag |= 1
210210 return 4
211211
@@ -221,7 +221,7 @@ async def err_trio():
221221 raise RuntimeError ("I has another owie" )
222222
223223 with pytest .raises (RuntimeError ) as err :
224- await aio_as_trio (partial (self .call_a_t , loop = loop ), loop = loop )(err_trio )
224+ await aio_as_trio (partial (self .call_a_t , loop = loop ))(err_trio )
225225 assert err .value .args [0 ] == "I has another owie"
226226
227227 @pytest .mark .trio
@@ -231,7 +231,7 @@ async def err_trio():
231231 raise RuntimeError ("I has another owie" )
232232
233233 with pytest .raises (RuntimeError ) as err :
234- await aio_as_trio (partial (self .call_a_t_depr , loop = loop ), loop = loop )(err_trio )
234+ await aio_as_trio (partial (self .call_a_t_depr , loop = loop ))(err_trio )
235235 assert err .value .args [0 ] == "I has another owie"
236236
237237 @pytest .mark .trio
@@ -253,7 +253,8 @@ async def err_trio():
253253
254254 with pytest .raises (RuntimeError ) as err :
255255 with test_utils .deprecate (self ):
256- await loop .run_asyncio (partial (self .call_a_t_depr , loop = loop ), err_trio )
256+ await loop .run_asyncio (partial (self .call_a_t_depr ,
257+ loop = loop ), err_trio )
257258 assert err .value .args [0 ] == "I has another owie"
258259
259260 @pytest .mark .trio
@@ -263,7 +264,7 @@ def err_trio_sync():
263264 raise RuntimeError ("I has more owie" )
264265
265266 with pytest .raises (RuntimeError ) as err :
266- await aio_as_trio (partial (self .call_a_ts , loop = loop ), loop = loop )(err_trio_sync )
267+ await aio_as_trio (partial (self .call_a_ts , loop = loop ))(err_trio_sync )
267268 assert err .value .args [0 ] == "I has more owie"
268269
269270 @pytest .mark .trio
@@ -280,7 +281,7 @@ def err_trio_sync():
280281 @pytest .mark .trio
281282 async def test_trio_asyncio_error (self , loop ):
282283 async def err_asyncio ():
283- await asyncio .sleep (0.01 , loop = loop )
284+ await asyncio .sleep (0.01 )
284285 raise RuntimeError ("I has an owie" )
285286
286287 with pytest .raises (RuntimeError ) as err :
@@ -290,7 +291,7 @@ async def err_asyncio():
290291 @pytest .mark .trio
291292 async def test_trio_asyncio_error_depr (self , loop ):
292293 async def err_asyncio ():
293- await asyncio .sleep (0.01 , loop = loop )
294+ await asyncio .sleep (0.01 )
294295 raise RuntimeError ("I has an owie" )
295296
296297 with pytest .raises (RuntimeError ) as err :
@@ -310,21 +311,21 @@ async def cancelled_trio(seen):
310311
311312 seen = Seen ()
312313 with pytest .raises (asyncio .CancelledError ):
313- await aio_as_trio (partial (self .call_a_t , loop = loop ), loop = loop )(cancelled_trio , seen )
314+ await aio_as_trio (partial (self .call_a_t , loop = loop ))(cancelled_trio , seen )
314315 assert seen .flag == 3
315316
316317 @pytest .mark .trio
317318 async def test_trio_asyncio_cancel_out (self , loop ):
318319 async def cancelled_asyncio (seen ):
319320 seen .flag |= 1
320- await asyncio .sleep (0.01 , loop = loop )
321- f = asyncio .Future (loop = loop )
321+ await asyncio .sleep (0.01 )
322+ f = asyncio .Future ()
322323 f .cancel ()
323324 return f .result () # raises error
324325
325326 def cancelled_future (seen ):
326327 seen .flag |= 1
327- f = asyncio .Future (loop = loop )
328+ f = asyncio .Future ()
328329 f .cancel ()
329330 return f # contains error
330331
@@ -347,14 +348,14 @@ async def check_cancel(proc, seen):
347348 async def test_trio_asyncio_cancel_out_depr (self , loop ):
348349 async def cancelled_asyncio (seen ):
349350 seen .flag |= 1
350- await asyncio .sleep (0.01 , loop = loop )
351- f = asyncio .Future (loop = loop )
351+ await asyncio .sleep (0.01 )
352+ f = asyncio .Future ()
352353 f .cancel ()
353354 return f .result () # raises error
354355
355356 def cancelled_future (seen ):
356357 seen .flag |= 1
357- f = asyncio .Future (loop = loop )
358+ f = asyncio .Future ()
358359 f .cancel ()
359360 return f # contains error
360361
@@ -387,7 +388,7 @@ async def in_trio(started, seen):
387388 seen .flag |= 2
388389
389390 async def cancel_asyncio (seen ):
390- started = asyncio .Event (loop = loop )
391+ started = asyncio .Event ()
391392 f = asyncio .ensure_future (self .call_a_t (in_trio , started , seen , loop = loop ))
392393 await started .wait ()
393394 f .cancel ()
@@ -396,15 +397,15 @@ async def cancel_asyncio(seen):
396397 seen .flag |= 8
397398
398399 seen = Seen ()
399- await aio_as_trio (cancel_asyncio , loop = loop )(seen )
400+ await aio_as_trio (cancel_asyncio )(seen )
400401 assert seen .flag == 1 | 2 | 8
401402
402403 @pytest .mark .trio
403404 async def test_trio_asyncio_cancel_in (self , loop ):
404405 async def in_asyncio (started , seen ):
405406 started .set ()
406407 try :
407- await asyncio .sleep (9999 , loop = loop )
408+ await asyncio .sleep (9999 )
408409 except asyncio .CancelledError :
409410 seen .flag |= 1
410411 except trio .Cancelled :
@@ -431,7 +432,7 @@ async def test_trio_asyncio_cancel_in_depr(self, loop):
431432 async def in_asyncio (started , seen ):
432433 started .set ()
433434 try :
434- await asyncio .sleep (9999 , loop = loop )
435+ await asyncio .sleep (9999 )
435436 except asyncio .CancelledError :
436437 seen .flag |= 1
437438 except trio .Cancelled :
@@ -527,7 +528,7 @@ def err_asyncio():
527528 async def test_trio_asyncio_generator (self , loop ):
528529 async def dly_asyncio ():
529530 yield 1
530- await asyncio .sleep (0.01 , loop = loop )
531+ await asyncio .sleep (0.01 )
531532 yield 2
532533
533534 with test_utils .deprecate (self ):
@@ -557,7 +558,7 @@ async def cancel_soon(nursery):
557558 await trio .sleep (0.01 )
558559 nursery .cancel_scope .cancel ()
559560
560- hold = asyncio .Event (loop = loop )
561+ hold = asyncio .Event ()
561562 seen = Seen ()
562563
563564 with test_utils .deprecate (self ):
@@ -571,7 +572,7 @@ async def cancel_soon(nursery):
571572 async def test_trio_asyncio_iterator (self , loop ):
572573 async def slow_nums ():
573574 for n in range (1 , 6 ):
574- await asyncio .sleep (0.01 , loop = loop )
575+ await asyncio .sleep (0.01 )
575576 yield n
576577
577578 sum = 0
@@ -583,13 +584,11 @@ async def slow_nums():
583584 async def test_trio_asyncio_iterator_depr (self , loop ):
584585 async def slow_nums ():
585586 for n in range (1 , 6 ):
586- await asyncio .sleep (0.01 , loop = loop )
587+ await asyncio .sleep (0.01 )
587588 yield n
588589
589590 sum = 0
590591 # with test_utils.deprecate(self): ## not yet
591- async for n in aio_as_trio (
592- slow_nums (), loop = loop
593- ):
592+ async for n in aio_as_trio (slow_nums ()):
594593 sum += n
595594 assert sum == 15
0 commit comments