diff --git a/developer_support_script/check_build_stability.py b/developer_support_script/check_build_stability.py index 1cda5f9a..b762e7aa 100644 --- a/developer_support_script/check_build_stability.py +++ b/developer_support_script/check_build_stability.py @@ -12,7 +12,7 @@ ERROR_THRESHOLD_PERCENTAGE = 50 -def request_json(url: str) -> Any: +def request_json(url: str) -> dict | None: """ Utility function to get Json data from Jenkins. @@ -63,7 +63,7 @@ def __init__(self, name: str) -> None: self.num_evaluate_builds = self._get_num_evaluate_builds() self.num_aborted_builds = self._get_num_aborted_builds() - def add_job(self, job): + def add_job(self, job: "JobData") -> None: """ add another job's results to here so we can get a summary across jobs """ @@ -113,7 +113,8 @@ def _get_num_aborted_builds(self) -> int: for build in self.builds["ABORTED"]: data = request_json( - f"https://epics-jenkins.isis.rl.ac.uk/job/{self.name}/{build['number']}/api/json?tree=actions[causes[*]]" + f"https://epics-jenkins.isis.rl.ac.uk/job/{self.name}/" + f"{build['number']}/api/json?tree=actions[causes[*]]" ) for action in data["actions"]: if ( @@ -153,7 +154,8 @@ def _get_test_reports(self) -> list[Any]: def _get_failed_tests(self) -> Counter: """ - Gets all the failed tests. The name is generated by using the the class name and the test name. + Gets all the failed tests. The name is generated by using + the class name and the test name. Returns: Counter: Key is test case name, value is number of failures. @@ -170,7 +172,8 @@ def _get_failed_tests(self) -> Counter: def print_results(self) -> None: """ - Prints the percentage of aborted builds for the job, the percentage of failures with no test report, and the percentage failure of each failing test. + Prints the percentage of aborted builds for the job, the percentage of + failures with no test report, and the percentage failure of each failing test. """ if not self.buildable: print("WARNING: build is currently disabled") @@ -179,13 +182,13 @@ def print_results(self) -> None: # Aborted builds. valid_builds = self.num_evaluate_builds + self.no_test_report_failures all_builds = valid_builds + self.num_aborted_builds - percentage_aborted_builds = (self.num_aborted_builds / all_builds) * 100 if all_builds > 0 else 0 + percentage_aborted_builds = ( + (self.num_aborted_builds / all_builds) * 100 if all_builds > 0 else 0 + ) level = calculate_level( percentage_aborted_builds, ERROR_THRESHOLD_PERCENTAGE, WARNING_THRESHOLD_PERCENTAGE ) - print( - f"{level}: Aborted builds [{percentage_aborted_builds:.0f}%]" - ) + print(f"{level}: Aborted builds [{percentage_aborted_builds:.0f}%]") # Failures with no test report # valid_builds will only be 0 if self.no_test_report_failures is also 0 @@ -200,7 +203,8 @@ def print_results(self) -> None: WARNING_THRESHOLD_PERCENTAGE, ) print( - f"{level}: Failed builds with no Test Report [{percentage_no_test_report_failures:.0f}%]" + f"{level}: Failed builds with no Test Report " + f"[{percentage_no_test_report_failures:.0f}%]" ) # Tests. @@ -212,12 +216,10 @@ def print_results(self) -> None: level = calculate_level( percentage_test_failure, ERROR_THRESHOLD_PERCENTAGE, WARNING_THRESHOLD_PERCENTAGE ) - print( - f"{level}: [{percentage_test_failure:.0f}%] {name}" - ) + print(f"{level}: [{percentage_test_failure:.0f}%] {name}") -def process_jobs(jobs, summary_name): +def process_jobs(jobs: list(str), summary_name: str) -> None: first = True job_summary = None for job in jobs: @@ -242,7 +244,12 @@ def process_jobs(jobs, summary_name): "System_Tests_win32", "System_Tests_galilold", "System_Tests_Win11", + "System_Tests_Win11_Win11", + ] + SQUISH_JOBS = [ + "System_Tests_Squish", + "System_Tests_Squish_Win11", + "System_Tests_Squish_Win11_Win11", ] - SQUISH_JOBS = ["System_Tests_Squish", "System_Tests_Squish_Win11"] process_jobs(EPICS_JOBS, "EPICS") process_jobs(SQUISH_JOBS, "SQUISH")