Files
e_power_switch/test/test.py
T
ponsin_h 20e6993577
CI / build-and-test (push) Successful in 44s
renaming folder
2026-06-10 11:24:22 +02:00

36 lines
799 B
Python

import subprocess
import sys
import signal
from caproto_wrapper import CaprotoWrapper
def is_ioc_running():
return "" != CaprotoWrapper.raw_read("ePowerSwitch_set_outlet_1")
def start_iocshell():
res = subprocess.Popen(["./startioc.sh"])
while not is_ioc_running():
pass
return res
def start_sim():
return subprocess.Popen(["python", "./sim/ePowerSwitch8_sim.py"])
def start_pytest():
return subprocess.Popen(["pytest","test"])
sim_process = start_sim()
iocsh_process = start_iocshell()
pytest_process = start_pytest()
exit_code = 0
try:
exit_code = pytest_process.wait()
finally:
sim_process.send_signal(sig=signal.SIGTERM)
iocsh_process.send_signal(sig=signal.SIGTERM)
pytest_process.send_signal(sig=signal.SIGTERM)
sys.exit(exit_code)