Remove custom test-skipping code in importlib tests for unittest code.

This commit is contained in:
Brett Cannon 2009-07-20 01:05:40 +00:00
parent 3c2738488a
commit 4dc3193973
1 changed files with 14 additions and 13 deletions

View File

@ -6,21 +6,22 @@ import unittest
import sys import sys
def case_insensitive_tests(class_): CASE_INSENSITIVE_FS = True
# Windows is the only OS that is *always* case-insensitive
# (OS X *can* be case-sensitive).
if sys.platform not in ('win32', 'cygwin'):
changed_name = __file__.upper()
if changed_name == __file__:
changed_name = __file__.lower()
if not os.path.exists(changed_name):
CASE_INSENSITIVE_FS = False
def case_insensitive_tests(test):
"""Class decorator that nullifies tests requiring a case-insensitive """Class decorator that nullifies tests requiring a case-insensitive
file system.""" file system."""
# Windows is the only OS that is *always* case-insensitive return unittest.skipIf(not CASE_INSENSITIVE_FS,
# (OS X *can* be case-sensitive). "requires a case-insensitive filesystem")(test)
if sys.platform not in ('win32', 'cygwin'):
changed_name = __file__.upper()
if changed_name == __file__:
changed_name = __file__.lower()
if os.path.exists(changed_name):
return class_
else:
return unittest.TestCase
else:
return class_
@contextmanager @contextmanager