aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/instantiate/service_macro.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/steps/instantiate/service_macro.py')
-rw-r--r--src/onaptests/steps/instantiate/service_macro.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/onaptests/steps/instantiate/service_macro.py b/src/onaptests/steps/instantiate/service_macro.py
index 4211cbf..a513d1e 100644
--- a/src/onaptests/steps/instantiate/service_macro.py
+++ b/src/onaptests/steps/instantiate/service_macro.py
@@ -77,7 +77,7 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
"""
if self.is_root:
if not self._yaml_template:
- with open(settings.SERVICE_YAML_TEMPLATE, "r") as yaml_template:
+ with open(settings.SERVICE_YAML_TEMPLATE, "r", encoding="utf-8") as yaml_template:
self._yaml_template: dict = load(yaml_template, SafeLoader)
return self._yaml_template
return self.parent.yaml_template
@@ -94,8 +94,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
"""
if self.is_root:
if not self._model_yaml_template:
- with open(settings.MODEL_YAML_TEMPLATE, "r") as model_yaml_template:
- self._model_yaml_template: dict = load(model_yaml_template)
+ with open(settings.MODEL_YAML_TEMPLATE, "r",
+ encoding="utf-8") as model_yaml_template:
+ self._model_yaml_template: dict = load(model_yaml_template, SafeLoader)
return self._model_yaml_template
return self.parent.model_yaml_template
@@ -215,9 +216,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
)
try:
service_instantiation.wait_for_finish(timeout=settings.ORCHESTRATION_REQUEST_TIMEOUT)
- except TimeoutError:
+ except TimeoutError as exc:
self._logger.error("Service instantiation %s timed out", self.service_instance_name)
- raise onap_test_exceptions.ServiceInstantiateException
+ raise onap_test_exceptions.ServiceInstantiateException from exc
if service_instantiation.failed:
self._logger.error("Service instantiation %s failed", self.service_instance_name)
raise onap_test_exceptions.ServiceInstantiateException
@@ -239,9 +240,9 @@ class YamlTemplateServiceMacroInstantiateStep(YamlTemplateBaseStep):
service_deletion = self._service_instance.delete(a_la_carte=False)
try:
service_deletion.wait_for_finish(timeout=settings.ORCHESTRATION_REQUEST_TIMEOUT)
- except TimeoutError:
+ except TimeoutError as exc:
self._logger.error("Service deletion %s timed out", self._service_instance_name)
- raise onap_test_exceptions.ServiceCleanupException
+ raise onap_test_exceptions.ServiceCleanupException from exc
if service_deletion.finished:
self._logger.info("Service %s deleted", self._service_instance_name)
else: