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 ------------------------------------------------------------------------
This commit is contained in:
parent
ec882214fe
commit
87082ee14d
|
@ -180,6 +180,9 @@ class GenericTest(unittest.TestCase):
|
||||||
safe_rmdir(support.TESTFN)
|
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):
|
class CommonTest(GenericTest):
|
||||||
# The path module to be tested
|
# The path module to be tested
|
||||||
pathmodule = None
|
pathmodule = None
|
||||||
|
|
|
@ -40,6 +40,18 @@ if sys.platform != 'darwin':
|
||||||
# NFKC('\u2001') == NFKC('\u2003')
|
# 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.
|
# Destroy directory dirname and all files under it, to one level.
|
||||||
def deltree(dirname):
|
def deltree(dirname):
|
||||||
# Don't hide legitimate errors: if one of these suckers exists, it's
|
# Don't hide legitimate errors: if one of these suckers exists, it's
|
||||||
|
@ -63,14 +75,8 @@ class UnicodeFileTests(unittest.TestCase):
|
||||||
files = set()
|
files = set()
|
||||||
for name in self.files:
|
for name in self.files:
|
||||||
name = os.path.join(support.TESTFN, self.norm(name))
|
name = os.path.join(support.TESTFN, self.norm(name))
|
||||||
try:
|
with open(name, 'wb') as f:
|
||||||
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.write((name+'\n').encode("utf-8"))
|
||||||
f.close()
|
|
||||||
os.stat(name)
|
os.stat(name)
|
||||||
files.add(name)
|
files.add(name)
|
||||||
self.files = files
|
self.files = files
|
||||||
|
|
Loading…
Reference in New Issue