diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2021-04-02 06:54:42 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-02 06:54:42 +0000 |
commit | b8037f19c416b3c66e735863cbb1143b75571236 (patch) | |
tree | ff33accbbe99f15c82c196d525d91ef55c18ca7e /src/onaptests/steps/base.py | |
parent | b8607c246f1765275f3a13c772eb27566db1269d (diff) | |
parent | 0a315a1b542a96d62fea12f49b353bca54464ee7 (diff) |
Merge "Basic VM macro"
Diffstat (limited to 'src/onaptests/steps/base.py')
-rw-r--r-- | src/onaptests/steps/base.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py index 8c67e5d..6d43fbc 100644 --- a/src/onaptests/steps/base.py +++ b/src/onaptests/steps/base.py @@ -5,7 +5,7 @@ import logging.config import time from abc import ABC, abstractmethod -from typing import Iterator, List +from typing import Iterator, List, Optional from onapsdk.aai.business import Customer from onapsdk.configuration import settings from onapsdk.exceptions import SDKException, SettingsError @@ -168,14 +168,15 @@ class BaseStep(ABC): try: if cleanup: self._start_cleanup_time = time.time() + execution_status: Optional[ReportStepStatus] = None ret = fun(self, *args, **kwargs) - execution_status: ReportStepStatus = ReportStepStatus.PASS + execution_status = ReportStepStatus.PASS return ret except SubstepExecutionException: - execution_status: ReportStepStatus = ReportStepStatus.PASS if cleanup else ReportStepStatus.NOT_EXECUTED + execution_status = ReportStepStatus.PASS if cleanup else ReportStepStatus.NOT_EXECUTED raise except (OnapTestException, SDKException): - execution_status: ReportStepStatus = ReportStepStatus.FAIL + execution_status = ReportStepStatus.FAIL raise finally: if cleanup: @@ -191,7 +192,7 @@ class BaseStep(ABC): self._start_execution_time = time.time() self._execution_report = Report( step_description=f"[{self.component}] {self.name}: {self.description}", - step_execution_status=execution_status, + step_execution_status=execution_status if execution_status else ReportStepStatus.FAIL, step_execution_duration=time.time() - self._start_execution_time ) return wrapper |