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 771cd714a94d0f36316a47018059f02f5292810f..2f2b862f6eadc585e8f2501b111999b88ceca90c 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 1db8ed5e9363f8556f61cd6520399f076a35d44b..b345c80aed0e13aff378c2dd555767aea8e8c556 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 """