Skip to content
Browse files

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/", line 1037, in emit
     stream.write(msg + self.terminator)
 TypeError: a bytes-like object is required, not 'str'
 Call stack:
   File "tools/", line 1734, in <module>
   File "tools/", line 1710, in Main
     if RunTestCases(cases_to_run, options.progress, options.j, options.flaky_tests):
   File "tools/", line 933, in RunTestCases
     return progress.Run(tasks)
   File "tools/", line 141, in Run
     self.RunSingle(False, 0)
   File "tools/", line 202, in RunSingle
   File "tools/", line 365, in HasRun'  ---')

PR-URL: #31156
Reviewed-By: Christian Clauss <>
Reviewed-By: Ruben Bridgewater <>
Reviewed-By: Colin Ihrig <>
Reviewed-By: Richard Lau <>
Reviewed-By: David Carlier <>
Reviewed-By: Rich Trott <>
Reviewed-By: Daijiro Wachi <>
  • Loading branch information
AdamMajer authored and Trott committed Jan 2, 2020
1 parent 85ef944 commit f2a089a754046c1bd950cebefd8bdb2960fdce32
Showing with 1 addition and 1 deletion.
  1. +1 −1 tools/
@@ -1534,7 +1534,7 @@ def Main():
if options.logfile:
fh = logging.FileHandler(options.logfile, mode='wb')
fh = logging.FileHandler(options.logfile, encoding='utf-8', mode='w')

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

0 comments on commit f2a089a

Please sign in to comment.
You can’t perform that action at this time.