##// END OF EJS Templates
Add test decorator onlyif_unicode_paths....
Thomas Kluyver -
Show More
@@ -5,7 +5,9 b' import os'
5 5 import tempfile
6 6
7 7 from IPython.core.application import Application
8 from IPython.testing import decorators as testdec
8 9
10 @testdec.onlyif_unicode_paths
9 11 def test_unicode_cwd():
10 12 """Check that IPython starts with non-ascii characters in the path."""
11 13 wd = tempfile.mkdtemp(suffix=u"€")
@@ -32,7 +34,8 b' def test_unicode_cwd():'
32 34 app.load_file_config(suppress_errors=False)
33 35 finally:
34 36 os.chdir(old_wd)
35
37
38 @testdec.onlyif_unicode_paths
36 39 def test_unicode_ipdir():
37 40 """Check that IPython starts with non-ascii characters in the IP dir."""
38 41 ipdir = tempfile.mkdtemp(suffix=u"€")
@@ -49,6 +49,7 b' Authors'
49 49 # Stdlib imports
50 50 import inspect
51 51 import sys
52 import tempfile
52 53 import unittest
53 54
54 55 # Third-party imports
@@ -318,3 +319,15 b" skip_known_failure = knownfailureif(True,'This test is known to fail')"
318 319 # A null 'decorator', useful to make more readable code that needs to pick
319 320 # between different decorators based on OS or other conditions
320 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