Repository navigation
Write the flaky report's output as UTF-8 on every runner - #601
Merged
Merged
Conversation
A Windows runner writes Python's stdout as cp1252, so printing a test name with a character outside it (the ⌘ in a shortcut test) raised right after the issue was filed; the run then warned that nothing was filed and skipped the rest of its flaky tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #583
Summary
On a Windows runner Python writes stdout as cp1252, so
scripts/ci-flaky-report.pyraisedUnicodeEncodeErrorwhen it printed a test name with a character outside that code page.In nightly run 37391023049 (shard 2/4) it filed #583 for "⌘D splits the focused pane ...", then raised on
print(f"filed {url} for {name}").The error is a
ValueError, somaincaught it as a failed filing: the run warned that 1 flaky test was not filed (it was), and any later flaky test in that run would have been skipped.The script now sets its stdout to UTF-8 when it runs as a script, which is what the Actions log reads on every runner.
Review
scripts/ci-flaky-report.py- the change is in the__main__block only, somain()called from the unit tests keeps the test runner's stdout.Evidence
PYTHONIOENCODING=cp1252and a fakeghon a report whose flaky test is named "⌘D splits the pane"; without the fix it fails with the same message as the CI run ('charmap' codec can't encode character '⌘'), with it the script exits 0 and prints the name.python3 -m unittest scripts.tests.test_ci_flaky_report18 pass.unittest discoversuite was left to the policy lane.