This commit is contained in:
Kanchan Sen Laskar 2024-09-29 21:30:48 +05:30 коммит произвёл LiliDeng
Родитель 4d93ac13b4
Коммит ff85745ac8
3 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -1487,6 +1487,9 @@ class TestCase(BaseTestCaseFilter):
field_function=fields.Int, validate=validate.Range(min=0)
),
)
# each test case will have this timeout
# if it is 0 it will use default timeout from test case
timeout: int = 0
# each case with this rule will be run in a new environment.
use_new_environment: bool = False
# Once it's set, failed test result will be rewrite to success

Просмотреть файл

@ -126,6 +126,13 @@ def _apply_settings(
applied_case_data.use_new_environment or case_runbook.use_new_environment
)
# check for positive value just to be clearer
applied_case_data.timeout = (
max(case_runbook.timeout, applied_case_data.timeout)
if (case_runbook.timeout and case_runbook.timeout > 0)
else applied_case_data.timeout
)
# use default value from selector
applied_case_data.select_action = action

Просмотреть файл

@ -522,6 +522,7 @@ class TestCaseRuntimeData:
self.select_action: str = ""
self.times: int = 1
self.retry: int = 0
self.timeout: int = metadata.timeout
self.use_new_environment: bool = metadata.use_new_environment
self.ignore_failure: bool = False
self.environment_name: str = ""
@ -630,7 +631,19 @@ class TestSuite:
constants.RUN_LOCAL_LOG_PATH
).as_posix()
case_result.set_status(TestStatus.RUNNING, "")
case_timeout = case_result.runtime_data.metadata.timeout
# check for positive value just to be clearer
case_timeout = (
max(
case_result.runtime_data.timeout,
case_result.runtime_data.metadata.timeout,
)
if (
case_result.runtime_data.timeout
and case_result.runtime_data.timeout > 0
)
else case_result.runtime_data.metadata.timeout
)
if is_continue:
is_continue = self.__before_case(