Files
motorDriverTests/tests/conftest.py

29 lines
645 B
Python

import time
from caproto.sync.client import read, write
import pytest
from common import read_config
TIMEOUT_READ = 2
@pytest.fixture(autouse=True)
def check_ioc_running():
config = read_config()
pvprefix = config['pvprefix']
"""
This function checks if the test IOC is already running.
"""
try:
read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ)
# Reading the check recird was successfull -> We assume that the IOC
# is running
return
except TimeoutError:
# IOC startup failed in the given time -> Raise an error
raise Exception('Start the test IOC first ()')