##// END OF EJS Templates
Add test decorator onlyif_unicode_paths....
Thomas Kluyver -
Show More
@@ -5,7 +5,9 b' import os'
5 import tempfile
5 import tempfile
6
6
7 from IPython.core.application import Application
7 from IPython.core.application import Application
8 from IPython.testing import decorators as testdec
8
9
10 @testdec.onlyif_unicode_paths
9 def test_unicode_cwd():
11 def test_unicode_cwd():
10 """Check that IPython starts with non-ascii characters in the path."""
12 """Check that IPython starts with non-ascii characters in the path."""
11 wd = tempfile.mkdtemp(suffix=u"€")
13 wd = tempfile.mkdtemp(suffix=u"€")
@@ -32,7 +34,8 b' def test_unicode_cwd():'
32 app.load_file_config(suppress_errors=False)
34 app.load_file_config(suppress_errors=False)
33 finally:
35 finally:
34 os.chdir(old_wd)
36 os.chdir(old_wd)
35
37
38 @testdec.onlyif_unicode_paths
36 def test_unicode_ipdir():
39 def test_unicode_ipdir():
37 """Check that IPython starts with non-ascii characters in the IP dir."""
40 """Check that IPython starts with non-ascii characters in the IP dir."""
38 ipdir = tempfile.mkdtemp(suffix=u"€")
41 ipdir = tempfile.mkdtemp(suffix=u"€")
@@ -49,6 +49,7 b' Authors'
49 # Stdlib imports
49 # Stdlib imports
50 import inspect
50 import inspect
51 import sys
51 import sys
52 import tempfile
52 import unittest
53 import unittest
53
54
54 # Third-party imports
55 # Third-party imports
@@ -318,3 +319,15 b" skip_known_failure = knownfailureif(True,'This test is known to fail')"
318 # A null 'decorator', useful to make more readable code that needs to pick
319 # A null 'decorator', useful to make more readable code that needs to pick
319 # between different decorators based on OS or other conditions
320 # between different decorators based on OS or other conditions
320 null_deco = lambda f: f
321 null_deco = lambda f: f
322
323 # Some tests only run where we can use unicode paths. Note that we can't just
324 # check os.path.supports_unicode_filenames, which is always False on Linux.
325 try:
326 tempfile.mkdtemp(u"€")
327 except UnicodeEncodeError:
328 unicode_paths = False
329 else:
330 unicode_paths = True
331
332 onlyif_unicode_paths = onlyif(unicode_paths, ("This test is only applicable "
333 "where we can use unicode in filenames."))
General Comments 0
You need to be logged in to leave comments. Login now