Add test decorator onlyif_unicode_paths. #471

merged 2 commits into from May 26, 2011


None yet

2 participants


Some of our tests hit an error where unicode paths weren't supported. Since they're specifically to test unicode paths, it didn't make sense to change them. This adds a decorator which skips them in those circumstances.

Closes gh-466

@fperez fperez and 1 other commented on an outdated diff May 26, 2011
@@ -318,3 +319,15 @@ skip_known_failure = knownfailureif(True,'This test is known to fail')
# A null 'decorator', useful to make more readable code that needs to pick
# between different decorators based on OS or other conditions
null_deco = lambda f: f
+# Some tests only run where we can use unicode paths. Note that we can't just
+# check os.path.supports_unicode_filenames, which is always False on Linux.
+ tempfile.mkdtemp(u"€")
fperez May 26, 2011 Owner

Looks good, but since you're putting explicit unicode in the file, it should carry an encoding mark at the top:

# -*- coding: utf-8 -*-
fperez May 26, 2011 Owner

Also, note that mkdtemp doesn't clean up the temporary directory. you might want to use instead

f = tempfile.NamedTemproraryFile(prefix=u"tmp€")

This will ensure we don't leave junk behind after each run of these tests.

takluyver May 26, 2011 Owner

I always seem to forget the encoding line. Will do on both counts.


@fperez: Followed your suggestions.

fperez commented May 26, 2011

Looks great, merge away!

@takluyver takluyver merged commit eeba6ff into ipython:master May 26, 2011

Rebased and merged.

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