File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 11import asyncio
2+ import sys
23import unittest
34from asyncio import sleep
45
@@ -29,13 +30,20 @@ async def start_server(self):
2930 await sleep (0.1 )
3031
3132 async def asyncSetUp (self ):
32- async with asyncio .timeout (delay = 2 ):
33+ if sys .version_info >= (3 ,11 ,0 ):
34+ async with asyncio .timeout (delay = 2 ):
35+ asyncio .create_task (self .start_server ())
36+ await asyncio .sleep (0.1 )
37+ else :
3338 asyncio .create_task (self .start_server ())
3439 await asyncio .sleep (0.1 )
3540
3641 async def test_asyncio (self ):
3742 context = AsyncioContext ("pva" )
38- async with asyncio .timeout (delay = 2 ):
43+ if sys .version_info >= (3 ,11 ,0 ):
44+ async with asyncio .timeout (delay = 2 ):
45+ value = await context .get ("demo:a" )
46+ else :
3947 value = await context .get ("demo:a" )
4048
4149 assert value == 5.5
You can’t perform that action at this time.
0 commit comments