Skip to content

Commit 5ce9345

Browse files
Add logging to problematic test
1 parent 206cd13 commit 5ce9345

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def create_random_prefix():
4242
return "".join(random.choice(string.ascii_uppercase) for _ in range(12))
4343

4444
# Can't use logging as it's not multiprocess safe, and
45-
# alteratives are overkill
45+
# alternatives are overkill
4646
def log(*args):
4747
print(datetime.now().strftime("%H:%M:%S"), *args)
4848

tests/sim_cothread_ioc.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from conftest import ADDRESS, log, select_and_recv
88

99
if __name__ == "__main__":
10+
log("sim_cothread_ioc starting")
1011
with Client(ADDRESS) as conn:
1112
import cothread
1213

@@ -18,16 +19,24 @@
1819

1920
import sim_records
2021

22+
log("sim_cothread_ioc records created")
23+
2124
# Run the IOC
2225
builder.LoadDatabase()
2326
softioc.iocInit()
2427

28+
log("sim_cothread_ioc ready")
29+
2530
conn.send("R") # "Ready"
2631

32+
log("sim_cothread_ioc waiting for Done")
33+
2734
select_and_recv(conn, "D") # "Done"
2835
# Attempt to ensure all buffers flushed - C code (from `import pvlog`)
2936
# may not be affected by these calls...
3037
sys.stdout.flush()
3138
sys.stderr.flush()
3239

40+
log("sim_cothread_ioc sending Done")
41+
3342
conn.send("D") # "Ready"

tests/test_cothread.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from multiprocessing.connection import Listener
44

5-
from conftest import requires_cothread, ADDRESS, select_and_recv
5+
from conftest import requires_cothread, ADDRESS, log, select_and_recv
66

77
@requires_cothread
88
def test_cothread_ioc(cothread_ioc):
@@ -12,8 +12,9 @@ def test_cothread_ioc(cothread_ioc):
1212
pre = cothread_ioc.pv_prefix
1313

1414
with Listener(ADDRESS) as listener, listener.accept() as conn:
15-
15+
log("test_cothread_ioc wait for Ready")
1616
select_and_recv(conn, "R") # "Ready"
17+
log("test_cothread_ioc Ready received")
1718

1819
# Start
1920
assert caget(pre + ":UPTIME").startswith("00:00:0")
@@ -31,9 +32,12 @@ def test_cothread_ioc(cothread_ioc):
3132
with Context("pva") as ctx:
3233
assert ctx.get(pre + ":STRINGOUT") == "something"
3334

35+
log("test_cothread_ioc sending Done")
3436
conn.send("D") # "Done"
3537

38+
log("test_cothread_ioc waiting for Done")
3639
select_and_recv(conn, "D") # "Done"
40+
log("test_cothread_ioc received Done")
3741

3842
# Stop
3943
cothread_ioc.proc.send_signal(signal.SIGINT)

0 commit comments

Comments
 (0)