mirror of
https://github.com/python/cpython.git
synced 2025-11-10 14:31:24 +00:00
Merged revisions 78585,78594,78606 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78585 | florent.xicluna | 2010-03-02 22:34:45 +0100 (mar, 02 mar 2010) | 2 lines Tentatively enable test_pep277 on all platforms. ........ r78594 | florent.xicluna | 2010-03-02 23:34:11 +0100 (mar, 02 mar 2010) | 2 lines Test test_pep277 is only relevant for Unicode-friendly filesystems. ........ r78606 | florent.xicluna | 2010-03-03 00:56:38 +0100 (mer, 03 mar 2010) | 2 lines Fix wording. ........
This commit is contained in:
parent
4fd181c1fb
commit
683a7e7c18
2 changed files with 13 additions and 4 deletions
|
|
@ -2,8 +2,6 @@
|
||||||
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
|
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
|
||||||
import sys, os, unittest
|
import sys, os, unittest
|
||||||
from test import support
|
from test import support
|
||||||
if not os.path.supports_unicode_filenames:
|
|
||||||
raise unittest.SkipTest("test works only on NT+")
|
|
||||||
|
|
||||||
filenames = [
|
filenames = [
|
||||||
'abc',
|
'abc',
|
||||||
|
|
@ -36,7 +34,12 @@ class UnicodeFileTests(unittest.TestCase):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
for name in self.files:
|
for name in self.files:
|
||||||
|
try:
|
||||||
f = open(name, 'wb')
|
f = open(name, 'wb')
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
if not os.path.supports_unicode_filenames:
|
||||||
|
raise unittest.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()
|
f.close()
|
||||||
os.stat(name)
|
os.stat(name)
|
||||||
|
|
@ -51,6 +54,9 @@ class UnicodeFileTests(unittest.TestCase):
|
||||||
raise support.TestFailed("Expected to fail calling '%s(%r)'"
|
raise support.TestFailed("Expected to fail calling '%s(%r)'"
|
||||||
% (fn.__name__, filename))
|
% (fn.__name__, filename))
|
||||||
except expected_exception as details:
|
except expected_exception as details:
|
||||||
|
# the "filename" exception attribute may be encoded
|
||||||
|
if isinstance(details.filename, bytes):
|
||||||
|
filename = filename.encode(sys.getfilesystemencoding())
|
||||||
if check_fn_in_exception and details.filename != filename:
|
if check_fn_in_exception and details.filename != filename:
|
||||||
raise support.TestFailed("Function '%s(%r) failed with "
|
raise support.TestFailed("Function '%s(%r) failed with "
|
||||||
"bad filename in the exception: %r"
|
"bad filename in the exception: %r"
|
||||||
|
|
@ -80,7 +86,7 @@ class UnicodeFileTests(unittest.TestCase):
|
||||||
f1 = os.listdir(support.TESTFN)
|
f1 = os.listdir(support.TESTFN)
|
||||||
f2 = os.listdir(str(support.TESTFN.encode("utf-8"),
|
f2 = os.listdir(str(support.TESTFN.encode("utf-8"),
|
||||||
sys.getfilesystemencoding()))
|
sys.getfilesystemencoding()))
|
||||||
sf2 = set("\\".join((str(support.TESTFN), f))
|
sf2 = set(os.path.join(str(support.TESTFN), f)
|
||||||
for f in f2)
|
for f in f2)
|
||||||
self.assertEqual(len(f1), len(self.files))
|
self.assertEqual(len(f1), len(self.files))
|
||||||
self.assertEqual(sf2, set(self.files))
|
self.assertEqual(sf2, set(self.files))
|
||||||
|
|
|
||||||
|
|
@ -824,6 +824,9 @@ Documentation
|
||||||
Tests
|
Tests
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
- Issue #767675: enable test_pep277 on POSIX platforms with Unicode-friendly
|
||||||
|
filesystem encoding.
|
||||||
|
|
||||||
- Issue #6292: for the moment at least, the test suite runs cleanly if python
|
- Issue #6292: for the moment at least, the test suite runs cleanly if python
|
||||||
is run with the -OO flag. Tests requiring docstrings are skipped.
|
is run with the -OO flag. Tests requiring docstrings are skipped.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue