Skip to content
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

Open binary no encoding #665

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

yaythomas
Copy link
Contributor

On open() binary mode should not allow an encoding argument. See #664.

If encoding is passed with binary mode, raise: ValueError(binary mode doesn't take an encoding argument)

Add unit test helper to check the open() constructor call. Test for both binary and text mode with encoding, where binary fails and text passes.

@yaythomas
Copy link
Contributor Author

When I did my local due diligence to pre-check that the CI checks will all pass, I got a mypy error:

pyfakefs/fake_filesystem_unittest.py:750: error: Module has no attribute "_HAS_FCOPYFILE"  [attr-defined]
Found 1 error in 1 file (checked 23 source files)

I'm pretty sure this is not related to the changeset under consideration.

It might have something to do with issue #542.

Copy link
Member

@mrbean-bremen mrbean-bremen left a comment

Choose a reason for hiding this comment

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

Thanks, this looks good! Can you add an entry to the release notes (CHANGES.md)?

                                                                                                                            On open() binary mode should not allow an encoding argument.
                                                                                                                            If encoding is passed with binary mode, raise:
                                                                                                                            ValueError(binary mode doesn\'t take an encoding argument)

                                                                                                                            Closes pytest-dev#664.
@mrbean-bremen mrbean-bremen merged commit 80daca8 into pytest-dev:master Feb 3, 2022
@yaythomas yaythomas deleted the binary-no-encoding branch February 3, 2022 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants