Commit de587c0c authored by Florent Xicluna's avatar Florent Xicluna

Merged manually from 2.7 branch to 3.x trunk.

  ------------------------------------------------------------------------
  r81149 | florent.xicluna | 2010-05-13 23:40:01 +0200 (jeu. 13 mai 2010) | 2 lignes

  Better test skipping, with message in the log.
  ------------------------------------------------------------------------
  r81150 | florent.xicluna | 2010-05-13 23:41:05 +0200 (jeu. 13 mai 2010) | 2 lignes

  Improve test feedback to troubleshoot issue #8423 on OS X.
  ------------------------------------------------------------------------
  r81151 | florent.xicluna | 2010-05-14 01:46:48 +0200 (ven. 14 mai 2010) | 2 lignes

  Revert changeset r81150 which helped diagnose issue #8423 on some OS X buildbot.
  ------------------------------------------------------------------------
  r82056 | florent.xicluna | 2010-06-17 22:30:56 +0200 (jeu. 17 juin 2010) | 2 lignes

  Add few words about test.test_genericpath.CommonTest
  ------------------------------------------------------------------------
parent 33c21890
......@@ -180,6 +180,9 @@ class GenericTest(unittest.TestCase):
safe_rmdir(support.TESTFN)
# Following TestCase is not supposed to be run from test_genericpath.
# It is inherited by other test modules (macpath, ntpath, posixpath).
class CommonTest(GenericTest):
# The path module to be tested
pathmodule = None
......
......@@ -40,6 +40,18 @@ if sys.platform != 'darwin':
# NFKC('\u2001') == NFKC('\u2003')
])
# Is it Unicode-friendly?
if not os.path.supports_unicode_filenames:
fsencoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
try:
for name in filenames:
name.encode(fsencoding)
except UnicodeEncodeError:
raise unittest.SkipTest("only NT+ and systems with "
"Unicode-friendly filesystem encoding")
# Destroy directory dirname and all files under it, to one level.
def deltree(dirname):
# Don't hide legitimate errors: if one of these suckers exists, it's
......@@ -63,14 +75,8 @@ class UnicodeFileTests(unittest.TestCase):
files = set()
for name in self.files:
name = os.path.join(support.TESTFN, self.norm(name))
try:
f = open(name, 'wb')
except UnicodeEncodeError:
if not os.path.supports_unicode_filenames:
self.skipTest("only NT+ and systems with Unicode-friendly"
"filesystem encoding")
f.write((name+'\n').encode("utf-8"))
f.close()
with open(name, 'wb') as f:
f.write((name+'\n').encode("utf-8"))
os.stat(name)
files.add(name)
self.files = files
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment