diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-28 23:14:45 +0000 | 
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-10-28 23:14:45 +0000 | 
| commit | bfd7b265b6e14c6e64e0f1fad9c9df5bb54d8f18 (patch) | |
| tree | 4803e486183c81b3f11d0fd31653eb12c123f625 /Lib | |
| parent | fc6f5a402043a2b1fc0940860ab7fbcdb5fdcd45 (diff) | |
| download | cpython-git-bfd7b265b6e14c6e64e0f1fad9c9df5bb54d8f18.tar.gz | |
#10209, test_pep277: disable test_normalize and test_listdir on darwin
These tests are irrevelant on this OS.
Diffstat (limited to 'Lib')
| -rw-r--r-- | Lib/test/test_pep277.py | 22 | 
1 files changed, 9 insertions, 13 deletions
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py index 2353330785..6d891e541e 100644 --- a/Lib/test/test_pep277.py +++ b/Lib/test/test_pep277.py @@ -122,22 +122,18 @@ class UnicodeFileTests(unittest.TestCase):              f.close()              os.stat(name) +    # Skip the test on darwin, because darwin does normalize the filename to +    # NFD (a variant of Unicode NFD form). Normalize the filename to NFC, NFKC, +    # NFKD in Python is useless, because darwin will normalize it later and so +    # open(), os.stat(), etc. don't raise any exception. +    @unittest.skipIf(sys.platform == 'darwin', 'irrevelant test on Mac OS X')      def test_normalize(self):          files = set(self.files)          others = set()          for nf in set(['NFC', 'NFD', 'NFKC', 'NFKD']):              others |= set(normalize(nf, file) for file in files)          others -= files -        if sys.platform == 'darwin': -            files = set(normalize('NFD', file) for file in files)          for name in others: -            if sys.platform == 'darwin' and normalize('NFD', name) in files: -                # Mac OS X decomposes Unicode names.  See comment above. -                try: -                    os.stat(name) -                except OSError as err: -                    raise AssertionError("File %a doesn't exist" % name) -                continue              self._apply_failure(open, name, IOError)              self._apply_failure(os.stat, name, OSError)              self._apply_failure(os.chdir, name, OSError) @@ -146,14 +142,14 @@ class UnicodeFileTests(unittest.TestCase):              # listdir may append a wildcard to the filename, so dont check              self._apply_failure(os.listdir, name, OSError, False) +    # Skip the test on darwin, because darwin uses a normalization different +    # than Python NFD normalization: filenames are different even if we use +    # Python NFD normalization. +    @unittest.skipIf(sys.platform == 'darwin', 'irrevelant test on Mac OS X')      def test_listdir(self):          sf0 = set(self.files)          f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding()))          f2 = os.listdir(support.TESTFN) -        if sys.platform == 'darwin': -            # Mac OS X decomposes Unicode names.  See comment above. -            sf0 = set(normalize('NFD', f) for f in self.files) -            f2 = [normalize('NFD', f) for f in f2]          sf2 = set(os.path.join(support.TESTFN, f) for f in f2)          self.assertEqual(sf0, sf2, "%a != %a" % (sf0, sf2))          self.assertEqual(len(f1), len(f2))  | 
