-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3 fixes - fix dirutil, fileutil, and xml_parser tests #6229
Python 3 fixes - fix dirutil, fileutil, and xml_parser tests #6229
Conversation
@@ -149,7 +149,7 @@ class Dir(datatype(['path'])): | |||
class File(datatype(['path', 'contents'])): | |||
@classmethod | |||
def empty(cls, path): | |||
return cls(path, contents=b'') | |||
return cls(path, contents='') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Throughout the tests for comparing trees, contents
was being encoded as byte strings in the expected output. I'm not sure why - the tests pass when unicode in Py2, and the bytes present an issue when using Py3.
@@ -396,7 +396,7 @@ def test_rm_rf_no_such_file_not_an_error(self, file_name='./vanishing_file'): | |||
def test_readwrite_file(self): | |||
with temporary_dir() as td: | |||
test_filename = os.path.join(td, 'test.out') | |||
test_content = '3333' | |||
test_content = b'3333' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Must be bytes for safe_file_dump()
and read_file()
to work.
…ild#6229) ### Problem Dirutil tests failing due to unicode vs bytes. `dirutil.py` itself is fine. I decided `safe_file_dump()` and `read_file()` should still work with bytes, not unicode. ### Related PRs To get completely green on Py3, requires pantsbuild#6226 and pantsbuild#6228. This can be merged before them both, though, as it shouldn't break Py2 and we aren't running Py3 yet.
Problem
Dirutil tests failing due to unicode vs bytes.
dirutil.py
itself is fine. I decidedsafe_file_dump()
andread_file()
should still work with bytes, not unicode.Related PRs
To get completely green on Py3, requires #6226 and #6228. This can be merged before them both, though, as it shouldn't break Py2 and we aren't running Py3 yet.