Files
e_power_switch/tests/test.py
T

36 lines
838 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", "/home/ponsin_h/ePowerSwitchStreamDevice/sim/ePowerSwitch8_sim.py"])
def start_pytest():
return subprocess.Popen(["pytest","tests"])
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)