From 33f18ba9f015cdfdac52b39424309a0e438dbd66 Mon Sep 17 00:00:00 2001 From: smathis Date: Tue, 22 Jul 2025 14:13:01 +0200 Subject: [PATCH] Some more fixes to MVP --- common.py | 2 +- ioc/startioc.py | 3 +++ tests/conftest.py | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) mode change 100644 => 100755 ioc/startioc.py 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)