|
1 | 1 | import time |
| 2 | +from datetime import datetime |
2 | 3 | from typing import Optional |
3 | 4 |
|
4 | 5 | import click |
@@ -29,8 +30,8 @@ def main(tc_user: str, tc_password: str): |
29 | 30 | else: |
30 | 31 | click.echo("Run automated tests") |
31 | 32 |
|
32 | | - tc_msg.testCount(len(tests_info.supported_shells)) |
33 | 33 | with tc_msg.testSuite("Automation tests"): |
| 34 | + tc_msg.testCount(len(tests_info.supported_shells)) |
34 | 35 | for shell_name in tests_info.supported_shells: |
35 | 36 | try: |
36 | 37 | build_id = _run_tests_for_shell(tc, tc_msg, shell_name, tests_info) |
@@ -81,23 +82,26 @@ def _wait_build_finish( |
81 | 82 | ) -> tuple[dict[str, bool], list[Exception]]: |
82 | 83 | builds_statuses = {} |
83 | 84 | errors = [] |
84 | | - start_time = time.time() |
| 85 | + start_time = datetime.now() |
85 | 86 | while triggered_builds: |
86 | 87 | time.sleep(BUILDS_CHECK_DELAY) |
87 | 88 | for shell_name, build_id in triggered_builds.copy().items(): |
88 | 89 | try: |
89 | 90 | build = tc.builds.get(f"id:{build_id}") |
90 | 91 | 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 | + ) |
101 | 105 | except Exception as e: |
102 | 106 | errors.append(e) |
103 | 107 | click.echo(e, err=True) |
|
0 commit comments