Skip to content

Commit ba9f52e

Browse files
committed
fix tc messages
1 parent 4441853 commit ba9f52e

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

scripts/trigger_auto_tests/main.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import time
2+
from datetime import datetime
23
from typing import Optional
34

45
import click
@@ -29,8 +30,8 @@ def main(tc_user: str, tc_password: str):
2930
else:
3031
click.echo("Run automated tests")
3132

32-
tc_msg.testCount(len(tests_info.supported_shells))
3333
with tc_msg.testSuite("Automation tests"):
34+
tc_msg.testCount(len(tests_info.supported_shells))
3435
for shell_name in tests_info.supported_shells:
3536
try:
3637
build_id = _run_tests_for_shell(tc, tc_msg, shell_name, tests_info)
@@ -81,23 +82,26 @@ def _wait_build_finish(
8182
) -> tuple[dict[str, bool], list[Exception]]:
8283
builds_statuses = {}
8384
errors = []
84-
start_time = time.time()
85+
start_time = datetime.now()
8586
while triggered_builds:
8687
time.sleep(BUILDS_CHECK_DELAY)
8788
for shell_name, build_id in triggered_builds.copy().items():
8889
try:
8990
build = tc.builds.get(f"id:{build_id}")
9091
if is_build_finished(build):
91-
with tc_msg.test(shell_name, testDuration=time.time() - start_time):
92-
is_success = is_build_success(build)
93-
builds_statuses[shell_name] = is_success
94-
triggered_builds.pop(shell_name)
95-
if not is_success:
96-
tc_msg.testFailed(
97-
shell_name,
98-
f"{shell_name} Automation tests is finished"
99-
f" with status {build.status}",
100-
)
92+
tc_msg.testStarted(shell_name)
93+
is_success = is_build_success(build)
94+
builds_statuses[shell_name] = is_success
95+
triggered_builds.pop(shell_name)
96+
if not is_success:
97+
tc_msg.testFailed(
98+
shell_name,
99+
f"{shell_name} Automation tests is finished"
100+
f" with status {build.status}",
101+
)
102+
tc_msg.testFinished(
103+
shell_name, testDuration=datetime.now() - start_time
104+
)
101105
except Exception as e:
102106
errors.append(e)
103107
click.echo(e, err=True)

0 commit comments

Comments
 (0)