Skip to content

Commit

Permalink
fixup! Added s-format and clear gating.yaml issues description
Browse files Browse the repository at this point in the history
  • Loading branch information
mvalik committed Feb 6, 2024
1 parent 49e3d36 commit 90e3b80
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 4 additions & 2 deletions greenwave/policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
4 changes: 2 additions & 2 deletions greenwave/tests/test_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
6 changes: 3 additions & 3 deletions greenwave/tests/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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


Expand All @@ -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


Expand Down

0 comments on commit 90e3b80

Please sign in to comment.