diff options
author | Adam Majer <amajer@suse.de> | 2020-01-02 14:41:09 +0100 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2020-01-08 07:43:55 -0800 |
commit | f2a089a754046c1bd950cebefd8bdb2960fdce32 (patch) | |
tree | 32140bdd44f33f4b38f3c00714f2a9a39b17ea83 /tools/test.py | |
parent | 85ef944f639532b230424b3c6b3a0c35caa80957 (diff) | |
download | node-new-f2a089a754046c1bd950cebefd8bdb2960fdce32.tar.gz |
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: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'tools/test.py')
-rwxr-xr-x | tools/test.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/test.py b/tools/test.py index b928662dec..112d5edaff 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1534,7 +1534,7 @@ def Main(): logger.addHandler(ch) logger.setLevel(logging.INFO) if options.logfile: - fh = logging.FileHandler(options.logfile, mode='wb') + fh = logging.FileHandler(options.logfile, encoding='utf-8', mode='w') logger.addHandler(fh) workspace = abspath(join(dirname(sys.argv[0]), '..')) |