From 196bfc2d2910553457a4fa5dbcb552dcbac94ef5 Mon Sep 17 00:00:00 2001 From: stedif <stefano.difrischia@inaf.it> Date: Wed, 10 Aug 2022 12:48:41 +0200 Subject: [PATCH] L2SS-780: set relative paths --- .../default/prometheus/test_tango_prometheus_client.py | 7 ++++--- .../test/prometheus/test_archiver_policy.py | 8 ++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py b/tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py index 771cd714a..2f2b862f6 100644 --- a/tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py +++ b/tangostationcontrol/tangostationcontrol/integration_test/default/prometheus/test_tango_prometheus_client.py @@ -12,11 +12,11 @@ from tangostationcontrol.integration_test.device_proxy import TestDeviceProxy from tango import Database import importlib -import sys +import sys, os import numpy module_name = 'ArchiverPolicy' -file_path = '/opt/lofar/tango/docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py' +file_path = os.path.join(os.path.realpath('..'), 'docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py') spec = importlib.util.spec_from_file_location(module_name, file_path) tpc_policy = importlib.util.module_from_spec(spec) sys.modules[module_name] = tpc_policy @@ -30,7 +30,8 @@ spec.loader.exec_module(tpc_cc) class TestPrometheusClient(BaseIntegrationTestCase): - CONFIG = tpc_policy.ArchiverPolicy.load_config('/opt/lofar/tango/docker-compose/tango-prometheus-exporter/lofar2-policy.json') + config_path = os.path.join(os.path.realpath('..'), 'docker-compose/tango-prometheus-exporter/lofar2-policy.json') + CONFIG = tpc_policy.ArchiverPolicy.load_config(config_path) def setUp(self): super().setUp() diff --git a/tangostationcontrol/tangostationcontrol/test/prometheus/test_archiver_policy.py b/tangostationcontrol/tangostationcontrol/test/prometheus/test_archiver_policy.py index 1db8ed5e9..b345c80ae 100644 --- a/tangostationcontrol/tangostationcontrol/test/prometheus/test_archiver_policy.py +++ b/tangostationcontrol/tangostationcontrol/test/prometheus/test_archiver_policy.py @@ -11,16 +11,16 @@ from tangostationcontrol.test import base import sys, os import importlib.util module_name = 'ArchiverPolicy' -home_path = os.path.expanduser('~') -file_path = 'docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py' -spec = importlib.util.spec_from_file_location(module_name, os.path.join(home_path,file_path)) +file_path = os.path.join(os.path.realpath('..'), 'docker-compose/tango-prometheus-exporter/code/tango-prometheus-client.py') +spec = importlib.util.spec_from_file_location(module_name, file_path) tpc = importlib.util.module_from_spec(spec) sys.modules[module_name] = tpc spec.loader.exec_module(tpc) class TestArchiverPolicy(base.TestCase): - tpc.ArchiverPolicy.load_config(os.path.join(home_path, 'docker-compose/tango-prometheus-exporter/lofar2-policy.json')) + config_path = os.path.join(os.path.realpath('..'), 'docker-compose/tango-prometheus-exporter/lofar2-policy.json') + CONFIG = tpc.ArchiverPolicy.load_config(config_path) def test_config_file(self): """ Test if policy config file is correctly retrieved """ -- GitLab