@@ -16,8 +16,8 @@ def asyncio_ioc():
1616 sim_ioc = os .path .join (os .path .dirname (__file__ ), "sim_asyncio_ioc.py" )
1717 cmd = [sys .executable , sim_ioc , PV_PREFIX ]
1818 proc = subprocess .Popen (
19- cmd , env = dict ( os . environ , PYTHONUNBUFFERED = "1" ) ,
20- stdin = subprocess . PIPE , stdout = subprocess .PIPE , stderr = subprocess .PIPE )
19+ cmd , stdin = subprocess . PIPE ,
20+ stdout = subprocess .PIPE , stderr = subprocess .PIPE )
2121 yield proc
2222 proc .kill ()
2323 out , err = proc .communicate ()
@@ -33,7 +33,9 @@ async def test_asyncio_ioc(asyncio_ioc):
3333 atexit .unregister (_catools ._catools_atexit )
3434
3535 # Start
36- assert await caget (PV_PREFIX + ":UPTIME" ) in ["00:00:00" , "00:00:01" ]
36+ assert await caget (PV_PREFIX + ":UPTIME" ) in [
37+ "00:00:00" , "00:00:01" , "00:00:02" , "00:00:03"
38+ ]
3739 # WAVEFORM
3840 await caput (PV_PREFIX + ":SINN" , 4 , wait = True )
3941 q = asyncio .Queue ()
@@ -42,11 +44,14 @@ async def test_asyncio_ioc(asyncio_ioc):
4244 # AO
4345 assert await caget (PV_PREFIX + ":AO2" ) == 12.45
4446 await caput (PV_PREFIX + ":AO2" , 3.56 , wait = True )
47+ await asyncio .sleep (0.3 )
4548 assert await caget (PV_PREFIX + ":AI" ) == 12.34
46- await asyncio .sleep (0.6 )
49+ await asyncio .sleep (0.5 )
4750 assert await caget (PV_PREFIX + ":AI" ) == 3.56
51+ # Wait for a bit longer for the print output to flush
52+ await asyncio .sleep (2 )
4853 # Stop
49- out , err = asyncio_ioc .communicate (b"exit\n " , timeout = 1 )
54+ out , err = asyncio_ioc .communicate (b"exit\n " , timeout = 5 )
5055 out = out .decode ()
5156 err = err .decode ()
5257 # Disconnect
0 commit comments