From 96ad2710034c8cda36eaf741bd59262cb27ea64d Mon Sep 17 00:00:00 2001 From: Stefan Berthold Date: Mon, 27 Mar 2023 18:18:28 +0200 Subject: [PATCH] use standard pager and more stable flake order (#3185) --- hack/bin/flaky_tests.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hack/bin/flaky_tests.py b/hack/bin/flaky_tests.py index e85f463c565..84bc8ad861e 100755 --- a/hack/bin/flaky_tests.py +++ b/hack/bin/flaky_tests.py @@ -6,6 +6,7 @@ import os import yaml import argparse +from pydoc import pager BUCKET_BASEURL = 'https://s3.eu-west-1.amazonaws.com/public.wire.com/ci/failing-tests' CONCOURSE_BASEURL = 'https://concourse.ops.zinfra.io/teams/main' @@ -115,7 +116,7 @@ def associate_comments(flakes, comments, default_comments=''): flake['comments'] = comments.get(flake['test_name'], default_comments) def sort_flakes(flakes): - flakes.sort(key=lambda f: len(f['fails']), reverse=True) + flakes.sort(key=lambda f: (-len(f['fails']), f['test_name']), reverse=False) for flake in flakes: flake['fails'].sort(key=lambda f: f['build']['end_time'], reverse=True) @@ -176,11 +177,6 @@ def pretty_flakes(flakes, today, logs=False): lines.append(pretty_flake(flake, today, logs)) return '\n'.join(lines) -def pager(s): - pipe = os.popen('less -RS', 'w') - pipe.write(s) - pipe.close() - explain = '''Tips: Run with --discover to manually discover new flaky tests