aboutsummaryrefslogtreecommitdiffstats
path: root/testing/parser.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2025-07-07 13:51:49 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2025-07-09 10:36:48 +0200
commitd6001e8f48275084473555e174fa70cc12fcba75 (patch)
tree9915c2183cafd803a5ea571c89fa320fe6103e31 /testing/parser.py
parent8c5896ca00e23fbfba4ddc07b48dc051c0c2913c (diff)
testrunner.py: Log slow tests
Pick-to: 6.9 Change-Id: If1da4deda2c059755d30c0f25f32d49e0868643f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'testing/parser.py')
-rw-r--r--testing/parser.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/testing/parser.py b/testing/parser.py
index c41c0a231..38be8d1ed 100644
--- a/testing/parser.py
+++ b/testing/parser.py
@@ -84,6 +84,10 @@ class TestResult:
rich_result: str = ""
+def sort_time_key(item):
+ return item.time
+
+
def _parse_tests(test_log):
"""
Create a TestResult object for every entry.
@@ -161,3 +165,10 @@ class TestParser:
res = "FATAL"
item.rich_result = res
yield item
+
+ def get_slowest_tests(self, max_count):
+ result = self.results.copy()
+ result.sort(key=sort_time_key, reverse=True)
+ if len(result) > max_count:
+ result = result[0:max_count - 1]
+ return result