Skip to content

Commit 0b45e32

Browse files
committed
Fix tests and docs on CI
1 parent 48908ea commit 0b45e32

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
# require all of history to see all tagged versions' docs
1717
fetch-depth: 0
18+
submodules: true
1819

1920
- name: Set up Python
2021
uses: actions/setup-python@v2

tests/sim_asyncio_ioc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
async def callback(value):
2020
await asyncio.sleep(0.5)
2121
print("async update %s" % value)
22+
# Make sure it goes as epicsExit will not flush this for us
23+
sys.stdout.flush()
2224
sim_records.t_ai.set(value)
2325

2426
t_ao = builder.aOut('AO2', initial_value=12.45, on_update=callback)

tests/test_asyncio.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)