summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-02-21 10:32:09 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-02-21 10:32:09 (GMT)
commit6d2e3f4dcf5a361e85dca4bbe9cbe7be20e6e4dd (patch)
tree546938d547f1cd731d6523adaafc90ce70533920 /Lib
parent1fa911654bf3368e3699592d60e8e4618bc88ea6 (diff)
downloadcpython-6d2e3f4dcf5a361e85dca4bbe9cbe7be20e6e4dd.zip
cpython-6d2e3f4dcf5a361e85dca4bbe9cbe7be20e6e4dd.tar.gz
cpython-6d2e3f4dcf5a361e85dca4bbe9cbe7be20e6e4dd.tar.bz2
Merged revisions 78272 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78272 | ezio.melotti | 2010-02-21 00:34:21 +0200 (Sun, 21 Feb 2010) | 1 line skip tests with a non-ascii cwd when the file system encoding is ascii ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_macpath.py9
-rw-r--r--Lib/test/test_posixpath.py10
2 files changed, 16 insertions, 3 deletions
diff --git a/Lib/test/test_macpath.py b/Lib/test/test_macpath.py
index 81374d1..24d8bb2 100644
--- a/Lib/test/test_macpath.py
+++ b/Lib/test/test_macpath.py
@@ -1,4 +1,5 @@
import os
+import sys
import macpath
from test import test_support
import unittest
@@ -12,7 +13,13 @@ class MacPathTestCase(unittest.TestCase):
# Issue 3426: check that abspath retuns unicode when the arg is unicode
# and str when it's str, with both ASCII and non-ASCII cwds
saved_cwd = os.getcwd()
- for cwd in (u'cwd', u'\xe7w\xf0'):
+ cwds = ['cwd']
+ try:
+ cwds.append(u'\xe7w\xf0'.encode(sys.getfilesystemencoding()
+ or 'ascii'))
+ except UnicodeEncodeError:
+ pass # the cwd can't be encoded -- test with ascii cwd only
+ for cwd in cwds:
try:
os.mkdir(cwd)
os.chdir(cwd)
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index ef3429f..4cdf551 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -1,7 +1,7 @@
import unittest
from test import test_support
-import posixpath, os
+import posixpath, os, sys
from posixpath import realpath, abspath, dirname, basename
# An absolute path to a temporary filename for testing. We can't rely on TESTFN
@@ -393,7 +393,13 @@ class PosixPathTest(unittest.TestCase):
# Issue 3426: check that abspath retuns unicode when the arg is unicode
# and str when it's str, with both ASCII and non-ASCII cwds
saved_cwd = os.getcwd()
- for cwd in (u'cwd', u'\xe7w\xf0'):
+ cwds = ['cwd']
+ try:
+ cwds.append(u'\xe7w\xf0'.encode(sys.getfilesystemencoding()
+ or 'ascii'))
+ except UnicodeEncodeError:
+ pass # the cwd can't be encoded -- test with ascii cwd only
+ for cwd in cwds:
try:
os.mkdir(cwd)
os.chdir(cwd)