Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

tests fail without unicode filename support #466

Closed
juliantaylor opened this Issue May 24, 2011 · 5 comments

Comments

Projects
None yet
2 participants

two tests fail when there is no unicode filename support:

$ LANG=C PATH=$PWD/IPython/scripts/:$PATH PYTHONPATH=$PWD IPython/scripts/iptest -v IPython.core

======================================================================
ERROR: Check that IPython starts with non-ascii characters in the path.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 186, in runTest
    self.test(*self.arg)
  File "/home/jtaylor/tmp/ipython/IPython/core/tests/test_application.py", line 11, in test_unicode_cwd
    wd = tempfile.mkdtemp(suffix=u"€")
  File "/usr/lib/python2.7/tempfile.py", line 318, in mkdtemp
    _os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 14: ordinal not in range(128)

======================================================================
ERROR: Check that IPython starts with non-ascii characters in the IP dir.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/nose/case.py", line 186, in runTest
    self.test(*self.arg)
  File "/home/jtaylor/tmp/ipython/IPython/core/tests/test_application.py", line 38, in test_unicode_ipdir
    ipdir = tempfile.mkdtemp(suffix=u"€")
  File "/usr/lib/python2.7/tempfile.py", line 318, in mkdtemp
    _os.mkdir(file, 0700)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 14: ordinal not in range(128)

if this is only a test issue then they should be skipped if os.path.supports_unicode_filenames is False

Owner

takluyver commented May 24, 2011

I think it's just a test issue. Those tests test conditions which you can't hit without unicode filenames (or Unicode in environment variables, but it's up to the user to set environment variables correctly.

Out of interest, what platform doesn't support Unicode filenames?

by default the debian package build machines use the C locale which does not support them

@ghost ghost assigned takluyver May 24, 2011

supports_unicode_filenames does not work as I expected it returns falso although my system does support it

at try catch around the tempfile.mkdtemp(suffix=u"€") or something with sys.getfilesystemencoding should work better

Owner

takluyver commented May 24, 2011

Discussion of supports_unicode_filenames is here: http://bugs.python.org/issue767645

To cut a long story short, it's fixed to False on Linux. I think the try-catch is the best way for cross platform use (getfilesystemencoding is irrelevant on Windows).

Owner

takluyver commented May 24, 2011

See PR #471

@takluyver takluyver closed this in df86e70 May 26, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment