From 6298a4579920be3bd321f8b37d5b0b1035cea5c8 Mon Sep 17 00:00:00 2001 From: Paul Ferrell Date: Sat, 21 Sep 2024 10:16:42 -0600 Subject: [PATCH] The 'errors' record for series now counts all errors for tests/series. --- lib/pavilion/series/info.py | 23 ++++++++++++++++------- test/tests/series_tests.py | 4 ++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/pavilion/series/info.py b/lib/pavilion/series/info.py index f80582525..fd5faa769 100644 --- a/lib/pavilion/series/info.py +++ b/lib/pavilion/series/info.py @@ -149,21 +149,30 @@ def errors(self) -> int: status_obj = self._get_status_file() + error_values = [ + 'ERROR', + 'CANCELLED', + 'TIMEOUT', + ] + errors = 0 for status in status_obj.history(): - if status.state in (status_file.SERIES_STATES.ERROR, - status_file.SERIES_STATES.BUILD_ERROR, - status_file.SERIES_STATES.CREATION_ERROR, - status_file.SERIES_STATES.KICKOFF_ERROR): - errors += 1 + for error_val in error_values: + if error_val in status.state: + errors += 1 + break for test_path in self._tests: test_info = self.test_info(test_path) if test_info is None: continue - if test_info.result == TestRun.ERROR: - errors += 1 + # Look for any bad test states + for error_val in error_values: + for state in test_info.state_history: + if error_val in state.state: + errors += 1 + break return errors diff --git a/test/tests/series_tests.py b/test/tests/series_tests.py index 212881099..74fc35d03 100644 --- a/test/tests/series_tests.py +++ b/test/tests/series_tests.py @@ -291,6 +291,10 @@ def test_ignore_errors(self): else: self.assertEqual(test.result, None) + # Check that the info object lists the proper number of errors. + series_info = series.SeriesInfo(self.pav_cfg, series_obj.path) + self.assertEqual(series_info.errors, 9) + def test_series_conditionals_only_if_ok(self): """Test that adding a conditional that always matches produces tests that run when expected."""