2929class TestLogWrapAsync (unittest .TestCase ):
3030 """async def differs from asyncio.coroutine."""
3131
32- @classmethod
33- def setUpClass (cls ):
34- """Global preparation for tests (run once per class)."""
35- cls .loop = asyncio .get_event_loop ()
36-
3732 def setUp (self ):
3833 """Preparation for tests.
3934
@@ -58,7 +53,7 @@ def test_coroutine_async(self):
5853 async def func ():
5954 pass
6055
61- self . loop . run_until_complete (func ())
56+ asyncio . run (func ())
6257 self .assertEqual (
6358 "DEBUG>Awaiting: \n func()\n DEBUG>Done: 'func' with result:\n None\n " ,
6459 self .stream .getvalue (),
@@ -73,7 +68,7 @@ def test_coroutine_async_as_argumented(self):
7368 async def func ():
7469 pass
7570
76- self . loop . run_until_complete (func ())
71+ asyncio . run (func ())
7772
7873 self .assertEqual (
7974 [
@@ -89,7 +84,7 @@ async def func():
8984 raise Exception ("Expected" )
9085
9186 with self .assertRaises (Exception ): # noqa: B017
92- self . loop . run_until_complete (func ())
87+ asyncio . run (func ())
9388
9489 self .assertEqual (
9590 "DEBUG>Awaiting: \n func()\n ERROR>Failed: \n func()\n Traceback (most recent call last):" ,
@@ -106,7 +101,7 @@ async def func():
106101 raise TypeError ("Blacklisted" )
107102
108103 with self .assertRaises (TypeError ):
109- self . loop . run_until_complete (func ())
104+ asyncio . run (func ())
110105
111106 # While we're not expanding result coroutine object from namespace,
112107 # do not check execution result
0 commit comments