From 90e3b80e52bbcaa23b28850138521f50e565ebe5 Mon Sep 17 00:00:00 2001 From: Valerij Maljulin Date: Fri, 26 Jan 2024 13:55:13 +0100 Subject: [PATCH] fixup! Added s-format and clear gating.yaml issues description --- greenwave/policies.py | 6 ++++-- greenwave/tests/test_policies.py | 4 ++-- greenwave/tests/test_summary.py | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/greenwave/policies.py b/greenwave/policies.py index 524365c..26e42f4 100644 --- a/greenwave/policies.py +++ b/greenwave/policies.py @@ -506,12 +506,14 @@ def to_text(self, test_count): msgstr = "" if self.non_test_msgs: msgstr = ", ".join( - self.sformat(f"{{num}} {msg}", num) for (msg, num) in self.non_test_msgs.items() + self.sformat(f"{{num}} {msg}", num) + for (msg, num) in sorted(self.non_test_msgs.items()) ) if self.test_msgs: addmsg = self.sformat("Of {num} required test{s}, ", test_count) addmsg += ", ".join( - self.sformat(f"{{num}} {msg}", num) for (msg, num) in self.test_msgs.items() + self.sformat(f"{{num}} {msg}", num) + for (msg, num) in sorted(self.test_msgs.items()) ) if msgstr: msgstr = f"{msgstr}. {addmsg}" diff --git a/greenwave/tests/test_policies.py b/greenwave/tests/test_policies.py index a01ae3a..2b3c771 100644 --- a/greenwave/tests/test_policies.py +++ b/greenwave/tests/test_policies.py @@ -90,9 +90,9 @@ def test_summarize_answers(): assert summarize_answers([testResultMissing]) == \ 'Of 1 required test, 1 result missing' assert summarize_answers([testResultFailed, testResultMissing]) == \ - 'Of 2 required tests, 1 test failed, 1 result missing' + 'Of 2 required tests, 1 result missing, 1 test failed' assert summarize_answers([testResultFailed, testResultMissing, testResultMissing]) == \ - 'Of 3 required tests, 1 test failed, 2 results missing' + 'Of 3 required tests, 2 results missing, 1 test failed' assert summarize_answers([testResultMissing, testResultPassed]) == \ 'Of 2 required tests, 1 result missing' diff --git a/greenwave/tests/test_summary.py b/greenwave/tests/test_summary.py index 1192f22..915ccee 100644 --- a/greenwave/tests/test_summary.py +++ b/greenwave/tests/test_summary.py @@ -104,7 +104,7 @@ def test_summary_one_failed_one_missing(): testResultFailed, testResultMissing, ] - exp = 'Of 2 required tests, 1 test failed, 1 result missing' + exp = 'Of 2 required tests, 1 result missing, 1 test failed' assert summarize_answers(answers) == exp @@ -114,7 +114,7 @@ def test_summary_one_passed_one_failed_one_missing(): testResultFailed, testResultMissing, ] - exp = 'Of 3 required tests, 1 test failed, 1 result missing' + exp = 'Of 3 required tests, 1 result missing, 1 test failed' assert summarize_answers(answers) == exp @@ -126,7 +126,7 @@ def test_summary_one_passed_one_failed_one_missing_two_errored(): testResultMissing, testResultErrored, ] - exp = 'Of 5 required tests, 2 tests errored, 1 test failed, 1 result missing' + exp = 'Of 5 required tests, 1 result missing, 2 tests errored, 1 test failed' assert summarize_answers(answers) == exp