diff --git a/IPython/core/application.py b/IPython/core/application.py index b0f085f..46c00d4 100644 --- a/IPython/core/application.py +++ b/IPython/core/application.py @@ -350,13 +350,13 @@ class Application(object): # our shipped copies of builtin profiles even if they don't have them # in their local ipython directory. prof_dir = os.path.join(get_ipython_package_dir(), 'config', 'profile') - self.config_file_paths = (os.getcwd(), self.ipython_dir, prof_dir) + self.config_file_paths = (os.getcwdu(), self.ipython_dir, prof_dir) def pre_load_file_config(self): """Do actions before the config file is loaded.""" pass - def load_file_config(self): + def load_file_config(self, suppress_errors=True): """Load the config file. This tries to load the config file from disk. If successful, the @@ -377,6 +377,8 @@ class Application(object): self.config_file_name, exc_info=True) self.file_config = Config() except: + if not suppress_errors: # For testing purposes + raise self.log.warn("Error loading config file: %s" % self.config_file_name, exc_info=True) self.file_config = Config() diff --git a/IPython/core/tests/test_application.py b/IPython/core/tests/test_application.py new file mode 100644 index 0000000..21da4d6 --- /dev/null +++ b/IPython/core/tests/test_application.py @@ -0,0 +1,33 @@ +"""Tests for IPython.core.application""" + +import os +import tempfile + +from IPython.core.application import Application + +def test_unicode_cwd(): + """Check that IPython can start with unicode characters in the path.""" + wd = tempfile.mkdtemp(suffix="€") + + 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) diff --git a/IPython/core/tests/test_magic.py b/IPython/core/tests/test_magic.py index 3444600..25ed013 100644 --- a/IPython/core/tests/test_magic.py +++ b/IPython/core/tests/test_magic.py @@ -293,9 +293,9 @@ def test_parse_options(): def test_dirops(): """Test various directory handling operations.""" - curpath = lambda :os.path.splitdrive(os.getcwd())[1].replace('\\','/') + curpath = lambda :os.path.splitdrive(os.getcwdu())[1].replace('\\','/') - startdir = os.getcwd() + startdir = os.getcwdu() ipdir = _ip.ipython_dir try: _ip.magic('cd "%s"' % ipdir)