diff --git a/common.py b/common.py index d7c9f9c..0bda0de 100644 --- a/common.py +++ b/common.py @@ -8,7 +8,7 @@ from caproto.sync.client import read, write def read_config(): root_dir = os.path.dirname(__file__) - with open(root_dir + "config.yaml", "r") as f: + with open(root_dir + "/config.yaml", "r") as f: return yaml.safe_load(f) diff --git a/ioc/startioc.py b/ioc/startioc.py old mode 100644 new mode 100755 index 9a5b75c..fa6d5ca --- a/ioc/startioc.py +++ b/ioc/startioc.py @@ -38,3 +38,6 @@ def startioc(): # Start the IOC itself subprocess.run(root_dir + 'ioc/st.cmd') + +if __name__ == __main__: + startioc() diff --git a/tests/conftest.py b/tests/conftest.py index 908e209..b0de487 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,13 +14,14 @@ TIMEOUT_READ = 3.0 def prepare_ioc(): config = read_config() + pvprefix = config['pvprefix'] """ This function checks if the test IOC is already running and attempts to start it, if that is not the case. """ try: - read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ) + read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ) # Reading the check recird was successfull -> We assume that the IOC # is running @@ -33,7 +34,7 @@ def prepare_ioc(): now = time.time() while now + TIMEOUT_IOC_STARTUP < time.time(): try: - read(f'{config['pvprefix']}:IOCREADY', timeout=TIMEOUT_READ) + read(f'{pvprefix}:IOCREADY', timeout=TIMEOUT_READ) return except TimeoutError: time.sleep(0.5)