diff --git a/src/monitoring/tests/test_unitary.py b/src/monitoring/tests/test_unitary.py index 60d15ef9d65127e1c20e376a012645e3e73c2145..28de8ca65f261a0a8fe46c4b67e8b113a1beacb0 100644 --- a/src/monitoring/tests/test_unitary.py +++ b/src/monitoring/tests/test_unitary.py @@ -61,6 +61,8 @@ from device.service.drivers import DRIVERS # pylint: disable=wrong-import-posit LOCAL_HOST = '127.0.0.1' MOCKSERVICE_PORT = 10000 +os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) +os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(MOCKSERVICE_PORT) DEVICE_SERVICE_PORT = MOCKSERVICE_PORT + get_service_port_grpc(ServiceNameEnum.DEVICE) # avoid privileged ports os.environ[get_env_var_name(ServiceNameEnum.DEVICE, ENVVAR_SUFIX_SERVICE_HOST )] = str(LOCAL_HOST) @@ -88,14 +90,9 @@ class MockContextService(GenericGrpcService): self.context_servicer = MockServicerImpl_Context() add_ContextServiceServicer_to_server(self.context_servicer, self.server) - def configure_env_vars(self): - os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_HOST )] = str(self.bind_address) - os.environ[get_env_var_name(ServiceNameEnum.CONTEXT, ENVVAR_SUFIX_SERVICE_PORT_GRPC)] = str(self.bind_port) - @pytest.fixture(scope='session') def context_service(): _service = MockContextService(MOCKSERVICE_PORT) - _service.configure_env_vars() _service.start() yield _service _service.stop()