Ensure config loader tests include unicode#396
Merged
minrk merged 1 commit intoipython:masterfrom May 3, 2017
Merged
Conversation
This reveals an exception on Windows: self = <traitlets.config.loader.PyFileConfigLoader object at 0x0000019D8035AD68> def _read_file_as_dict(self): """Load the config file into self.config, with recursive loading.""" def get_config(): """Unnecessary now, but a deprecation warning is more trouble than it's worth.""" return self.config namespace = dict( c=self.config, load_subconfig=self.load_subconfig, get_config=get_config, __file__=self.full_filename, ) fs_encoding = sys.getfilesystemencoding() or 'ascii' > conf_filename = self.full_filename.encode(fs_encoding) E UnicodeEncodeError: 'mbcs' codec can't encode characters in position 0--1: invalid character
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds unicode characters to the paths of the config loader tests. This reveals an exception on Windows:
On Windows,
sys.getfilesystemencoding()should not really be used to encode file paths.Not entirely sure how to best solve this in a way that is compatible with all Python/OSes, so no solution suggested yet, but for a pure Windows solution I would just remove the encoding step (
conf_filename = self.full_filenamepasses tests on Win/Python 3.6).