Check that on a platform that is expected to have a case-insensitive filesystem

that is in fact the case.

Closes issue #5442.
This commit is contained in:
Brett Cannon 2009-04-02 05:17:54 +00:00
parent bd25d337ba
commit a3d056ed95
1 changed files with 8 additions and 1 deletions

View File

@ -1,7 +1,7 @@
from contextlib import contextmanager from contextlib import contextmanager
import imp import imp
import os.path import os.path
from test.support import unlink from test import support
import unittest import unittest
import sys import sys
@ -10,6 +10,13 @@ def case_insensitive_tests(class_):
"""Class decorator that nullifies tests that require a case-insensitive """Class decorator that nullifies tests that require a case-insensitive
file system.""" file system."""
if sys.platform not in ('win32', 'darwin', 'cygwin'): if sys.platform not in ('win32', 'darwin', 'cygwin'):
original_name = os.path.listdir('.')[0]
if name.upper() != name:
changed_name = name.upper()
else:
changed_name = name.lower()
if os.path.exists(changed_name):
return class_
return unittest.TestCase return unittest.TestCase
else: else:
return class_ return class_