Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f93095d

Browse filesBrowse files
AdamMajerMylesBorins
authored andcommitted
test: fix unit test logging with python3
A logfile must be opened as a text file and encoding is specified. Then it can accept a string. Current behaviour we get, Message: 'ok 2834 sequential/test-worker-prof' Arguments: () --- Logging error --- Traceback (most recent call last): File "/usr/lib64/python3.7/logging/__init__.py", line 1037, in emit stream.write(msg + self.terminator) TypeError: a bytes-like object is required, not 'str' Call stack: File "tools/test.py", line 1734, in <module> sys.exit(Main()) File "tools/test.py", line 1710, in Main if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests): File "tools/test.py", line 933, in RunTestCases return progress.Run(tasks) File "tools/test.py", line 141, in Run self.RunSingle(False, 0) File "tools/test.py", line 202, in RunSingle self.HasRun(output) File "tools/test.py", line 365, in HasRun logger.info(' ---') PR-URL: #31156 Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent 66fe923 commit f93095d
Copy full SHA for f93095d

File tree

Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-1
lines changed
Open diff view settings
Collapse file

‎tools/test.py‎

Copy file name to clipboardExpand all lines: tools/test.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ def Main():
15341534
logger.addHandler(ch)
15351535
logger.setLevel(logging.INFO)
15361536
if options.logfile:
1537-
fh = logging.FileHandler(options.logfile, mode='wb')
1537+
fh = logging.FileHandler(options.logfile, encoding='utf-8', mode='w')
15381538
logger.addHandler(fh)
15391539

15401540
workspace = abspath(join(dirname(sys.argv[0]), '..'))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.