Flexible PV prefix naming
This commit is contained in:
@@ -4,18 +4,23 @@ from caproto.sync.client import read, write
|
||||
from ioc.startioc import startioc
|
||||
import pytest
|
||||
|
||||
from common import read_config
|
||||
|
||||
TIMEOUT_IOC_STARTUP = 30
|
||||
TIMEOUT_READ = 3.0
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def prepare_ioc():
|
||||
|
||||
config = read_config()
|
||||
|
||||
"""
|
||||
This function checks if the test IOC is already running and attempts to
|
||||
start it, if that is not the case.
|
||||
"""
|
||||
try:
|
||||
read('MOTORDRIVERTESTS:IOCREADY', timeout=TIMEOUT_READ)
|
||||
read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ)
|
||||
|
||||
# Reading the check recird was successfull -> We assume that the IOC
|
||||
# is running
|
||||
@@ -24,11 +29,11 @@ def prepare_ioc():
|
||||
# Received a timeout error -> Start the IOC
|
||||
startioc()
|
||||
|
||||
# Check every few seconds if the IOC started successfully
|
||||
# Check periodically if the IOC started successfully
|
||||
now = time.time()
|
||||
while now + TIMEOUT_IOC_STARTUP < time.time():
|
||||
try:
|
||||
read('MOTORDRIVERTESTS:IOCREADY', timeout=TIMEOUT_READ)
|
||||
read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ)
|
||||
return
|
||||
except TimeoutError:
|
||||
time.sleep(0.5)
|
||||
|
||||
Reference in New Issue
Block a user