##// END OF EJS Templates
Tweak code with suggestions from yesterday.
Thomas Kluyver -
Show More
@@ -285,7 +285,8 b' class PyFileConfigLoader(FileConfigLoader):'
285 return self.config
285 return self.config
286
286
287 namespace = dict(load_subconfig=load_subconfig, get_config=get_config)
287 namespace = dict(load_subconfig=load_subconfig, get_config=get_config)
288 conf_filename = self.full_filename.encode(sys.getfilesystemencoding())
288 fs_encoding = sys.getfilesystemencoding() or 'ascii'
289 conf_filename = self.full_filename.encode(fs_encoding)
289 execfile(conf_filename, namespace)
290 execfile(conf_filename, namespace)
290
291
291 def _convert_to_config(self):
292 def _convert_to_config(self):
@@ -362,6 +362,10 b' class Application(object):'
362 This tries to load the config file from disk. If successful, the
362 This tries to load the config file from disk. If successful, the
363 ``CONFIG_FILE`` config variable is set to the resolved config file
363 ``CONFIG_FILE`` config variable is set to the resolved config file
364 location. If not successful, an empty config is used.
364 location. If not successful, an empty config is used.
365
366 By default, errors in loading config are handled, and a warning
367 printed on screen. For testing, the suppress_errors option is set
368 to False, so errors will make tests fail.
365 """
369 """
366 self.log.debug("Attempting to load config file: %s" %
370 self.log.debug("Attempting to load config file: %s" %
367 self.config_file_name)
371 self.config_file_name)
@@ -16,6 +16,7 b' from __future__ import print_function'
16
16
17 # Stdlib imports
17 # Stdlib imports
18 import linecache
18 import linecache
19 import sys
19
20
20 # Third-party imports
21 # Third-party imports
21 import nose.tools as nt
22 import nose.tools as nt
@@ -47,10 +48,12 b' def test_compiler():'
47 cp('x=1', 'single')
48 cp('x=1', 'single')
48 nt.assert_true(len(linecache.cache) > ncache)
49 nt.assert_true(len(linecache.cache) > ncache)
49
50
50 def test_compiler_unicode():
51 def setUp():
51 import sys
52 # Check we're in a proper Python 2 environment (some imports, such
53 # as GTK, can change the default encoding, which can hide bugs.)
52 nt.assert_equal(sys.getdefaultencoding(), "ascii")
54 nt.assert_equal(sys.getdefaultencoding(), "ascii")
53
55
56 def test_compiler_unicode():
54 cp = compilerop.CachingCompiler()
57 cp = compilerop.CachingCompiler()
55 ncache = len(linecache.cache)
58 ncache = len(linecache.cache)
56 cp(u"t = 'žćčšđ'", "single")
59 cp(u"t = 'žćčšđ'", "single")
@@ -17,8 +17,10 b' import nose.tools as nt'
17 from IPython.utils.tempdir import TemporaryDirectory
17 from IPython.utils.tempdir import TemporaryDirectory
18 from IPython.core.history import HistoryManager, extract_hist_ranges
18 from IPython.core.history import HistoryManager, extract_hist_ranges
19
19
20 def test_history():
20 def setUp():
21 nt.assert_equal(sys.getdefaultencoding(), "ascii")
21 nt.assert_equal(sys.getdefaultencoding(), "ascii")
22
23 def test_history():
22 ip = get_ipython()
24 ip = get_ipython()
23 with TemporaryDirectory() as tmpdir:
25 with TemporaryDirectory() as tmpdir:
24 #tmpdir = '/software/temp'
26 #tmpdir = '/software/temp'
@@ -168,6 +168,10 b' def make_exclude():'
168
168
169 if not have['wx']:
169 if not have['wx']:
170 exclusions.append(ipjoin('lib', 'inputhookwx'))
170 exclusions.append(ipjoin('lib', 'inputhookwx'))
171
172 # We do this unconditionally, so that the test suite doesn't import
173 # gtk, changing the default encoding and masking some unicode bugs.
174 exclusions.append(ipjoin('lib', 'inputhookgtk'))
171
175
172 # These have to be skipped on win32 because the use echo, rm, cd, etc.
176 # These have to be skipped on win32 because the use echo, rm, cd, etc.
173 # See ticket https://bugs.launchpad.net/bugs/366982
177 # See ticket https://bugs.launchpad.net/bugs/366982
General Comments 0
You need to be logged in to leave comments. Login now