-
Notifications
You must be signed in to change notification settings - Fork 87
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
Byte string read and write does not work for Python3 #63
Comments
I'd think this is OK to leave as it is. A write to a non-binary filehandle in Python 3 results in an error:
|
Thank you for lending your expertise with binary files. Indeed the test as it is now does not work with binary data in Python3. I was thinking that the test should be updated to write the file in mode 'wb' and read it in mode 'rb'. When you do this, pyfakefs raises an exception, complaining that the data cannot be encoded as ascii. This is a bug in pyfakefs. So I think that the solution it to change the modes in the test to 'wb' and 'rb', and then fixing pyfakes so that the test passes. |
OK, I see what you mean now. The changes I made in #60 should take care of the pyfakefs problem. I've just added the test case you suggested and another one to test Py3-specific behavior with writing in binary and reading in non-binary. |
Tests pass. Good thing I left it to the expert! |
This is tested by test
pyfakefs.fake_filesystem_test.FakeFileOpenTest.testByteContents()
, which is currently skipped for Python 3 and above.The text was updated successfully, but these errors were encountered: