Skip to content

Conversation

@AdamMajer
Copy link
Contributor

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
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(' ---')

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added test Issues and PRs related to the tests. tools Issues and PRs related to the tools directory. labels Jan 2, 2020
@BridgeARBridgeAR requested a review from cclaussJanuary 2, 2020 14:04
Copy link
Contributor

@cclausscclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

encoding will default to utf.8 if not specified and mode will default to wt if not specified but the Zen of Python does state that Explicit is better than implicit.

@nodejs-github-bot
Copy link
Collaborator

@BridgeARBridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 2, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@cclauss
Copy link
Contributor

6 times the Jenkins test failed. Is this change breaking those tests?

@Trott
Copy link
Member

Trott commented Jan 4, 2020

6 times the Jenkins test failed. Is this change breaking those tests?

Seems like it, on Windows at least:

10:02:14 > echo running 'python tools\test.py --mode=release --flaky-tests=dontcare --run=0,4 -J -p tap --logfile test.tap default' 10:02:14 running 'python tools\test.py --mode=release --flaky-tests=dontcare --run=0,4 -J -p tap --logfile test.tap default' 10:02:14 10:02:14 > python tools\test.py --mode=release --flaky-tests=dontcare --run=0,4 -J -p tap --logfile test.tap default 10:02:14 Traceback (most recent call last): 10:02:14 File "tools\test.py", line 1724, in <module> 10:02:14 sys.exit(Main()) 10:02:14 File "tools\test.py", line 1537, in Main 10:02:14 fh = logging.FileHandler(options.logfile, encoding='utf-8', mode='wt') 10:02:14 File "C:\Python27\lib\logging\__init__.py", line 920, in __init__ 10:02:14 StreamHandler.__init__(self, self._open()) 10:02:14 File "C:\Python27\lib\logging\__init__.py", line 952, in _open 10:02:14 stream = codecs.open(self.baseFilename, self.mode, self.encoding) 10:02:14 File "C:\Python27\lib\codecs.py", line 898, in open 10:02:14 file = __builtin__.open(filename, mode, buffering) 10:02:14 ValueError: Invalid mode ('wtb') 

@TrottTrott removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 4, 2020
Copy link
Contributor

@cclausscclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must be addressed: #31156 (comment)

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(' ---')
@AdamMajer
Copy link
ContributorAuthor

Rebased and changed the mode to just 'w'. It still functions correctly with python3 on Linux. Hopefully this will be enough for python on Windows.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot
Copy link
Collaborator

@Trott
Copy link
Member

Trott commented Jan 8, 2020

Landed in f2a089a

@TrottTrott closed this Jan 8, 2020
Trott pushed a commit that referenced this pull request Jan 8, 2020
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
@codebyterecodebytere mentioned this pull request Jan 16, 2020
codebytere pushed a commit that referenced this pull request Mar 14, 2020
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 <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Daijiro Wachi <[email protected]>
@codebyterecodebytere mentioned this pull request Mar 17, 2020
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testIssues and PRs related to the tests.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@AdamMajer@nodejs-github-bot@cclauss@Trott@watilde@cjihrig@devnexen@richardlau@BridgeAR