11import time
2+ from typing import Optional
23
34import click
45from dohq_teamcity import TeamCity
1819
1920def main (tc_user : str , tc_password : str ):
2021 errors = []
21- triggered_builds = {}
22+ triggered_builds : dict [ str , int ] = {}
2223 tc = TeamCity (TC_URL , auth = (tc_user , tc_password ))
2324 tests_info = AutoTestsInfo .get_current (tc )
2425 if tests_info .re_run_builds :
@@ -28,7 +29,8 @@ def main(tc_user: str, tc_password: str):
2829
2930 for shell_name in tests_info .supported_shells :
3031 try :
31- triggered_builds = _run_tests_for_shell (tc , shell_name , tests_info )
32+ build_id = _run_tests_for_shell (tc , shell_name , tests_info )
33+ triggered_builds [shell_name ] = build_id
3234 except Exception as e :
3335 errors .append (e )
3436 click .echo (e , err = True )
@@ -43,8 +45,8 @@ def main(tc_user: str, tc_password: str):
4345
4446def _run_tests_for_shell (
4547 tc : TeamCity , shell_name : str , tests_info : AutoTestsInfo
46- ) -> dict [ str , int ]:
47- triggered_builds = {}
48+ ) -> Optional [ int ]:
49+ build_id = None
4850 if is_shell_uses_package (shell_name , tests_info ):
4951 if tests_info .re_run_builds :
5052 if is_last_build_successful (tc , shell_name , tests_info ):
@@ -55,14 +57,12 @@ def _run_tests_for_shell(
5557 else :
5658 click .echo (f"{ shell_name } Re run automation tests" )
5759 build_id = trigger_auto_tests_build2 (tc , shell_name , tests_info )
58- triggered_builds [shell_name ] = build_id
5960 else :
6061 click .echo (f"{ shell_name } Automation tests build triggering" )
6162 build_id = trigger_auto_tests_build2 (tc , shell_name , tests_info )
62- triggered_builds [shell_name ] = build_id
6363 else :
6464 click .echo (f"{ shell_name } is not uses package with this version, skipped tests" )
65- return triggered_builds
65+ return build_id
6666
6767
6868def _wait_build_finish (
0 commit comments