-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Unicode issues #252
Merged
Merged
Unicode issues #252
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5acaf96
Fix compilerop to handle unicode input.
takluyver a865250
Test case for the failure to compile code including unicode characters.
takluyver 4ac6905
Add test for reloading history including unicode (currently fails).
takluyver 04d5253
Fix for loading history with unicode characters. Not sure if this is …
takluyver 66d514c
Remove check for GTK in tests, so that the default encoding remains a…
rkern 88c823a
Moved unicode tests into main test suite. Reverified that both fail i…
takluyver 3a53644
Fix for unicode in inputsplitter.
takluyver 7a0ba14
Add file encoding declarations to two tests.
takluyver fb96e09
Tweak unicode history test so it will work in Windows.
takluyver 1017c44
IPython behaves properly when started in a directory with non-ascii c…
takluyver 6b21f59
Fix for non-ascii characters in IPYTHONDIR, + unit test.
takluyver 11b36e2
Small tweaks to unicode in test file.
takluyver dad1e44
Fix up so tests pass again. input_splitter now uses ast module instea…
takluyver 0ae4841
Further fixes and tweaks for inputsplitter.
takluyver 528125c
Tweak code with suggestions from yesterday.
takluyver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# coding: utf-8 | ||
"""Tests for IPython.core.application""" | ||
|
||
import os | ||
import tempfile | ||
|
||
from IPython.core.application import Application | ||
|
||
def test_unicode_cwd(): | ||
"""Check that IPython starts with non-ascii characters in the path.""" | ||
wd = tempfile.mkdtemp(suffix=u"€") | ||
|
||
old_wd = os.getcwdu() | ||
os.chdir(wd) | ||
#raise Exception(repr(os.getcwd())) | ||
try: | ||
app = Application() | ||
# The lines below are copied from Application.initialize() | ||
app.create_default_config() | ||
app.log_default_config() | ||
app.set_default_config_log_level() | ||
|
||
# Find resources needed for filesystem access, using information from | ||
# the above two | ||
app.find_ipython_dir() | ||
app.find_resources() | ||
app.find_config_file_name() | ||
app.find_config_file_paths() | ||
|
||
# File-based config | ||
app.pre_load_file_config() | ||
app.load_file_config(suppress_errors=False) | ||
finally: | ||
os.chdir(old_wd) | ||
|
||
def test_unicode_ipdir(): | ||
"""Check that IPython starts with non-ascii characters in the IP dir.""" | ||
ipdir = tempfile.mkdtemp(suffix=u"€") | ||
|
||
# Create the config file, so it tries to load it. | ||
with open(os.path.join(ipdir, 'ipython_config.py'), "w") as f: | ||
pass | ||
|
||
old_ipdir1 = os.environ.pop("IPYTHONDIR", None) | ||
old_ipdir2 = os.environ.pop("IPYTHON_DIR", None) | ||
os.environ["IPYTHONDIR"] = ipdir.encode("utf-8") | ||
try: | ||
app = Application() | ||
# The lines below are copied from Application.initialize() | ||
app.create_default_config() | ||
app.log_default_config() | ||
app.set_default_config_log_level() | ||
|
||
# Find resources needed for filesystem access, using information from | ||
# the above two | ||
app.find_ipython_dir() | ||
app.find_resources() | ||
app.find_config_file_name() | ||
app.find_config_file_paths() | ||
|
||
# File-based config | ||
app.pre_load_file_config() | ||
app.load_file_config(suppress_errors=False) | ||
finally: | ||
if old_ipdir1: | ||
os.environ["IPYTHONDIR"] = old_ipdir1 | ||
if old_ipdir2: | ||
os.environ["IPYTHONDIR"] = old_ipdir2 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
Explain suppress errors in docstring