Remove custom test-skipping code in importlib tests for unittest code.
This commit is contained in:
parent
3c2738488a
commit
4dc3193973
|
@ -6,21 +6,22 @@ import unittest
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def case_insensitive_tests(class_):
|
CASE_INSENSITIVE_FS = True
|
||||||
"""Class decorator that nullifies tests requiring a case-insensitive
|
|
||||||
file system."""
|
|
||||||
# Windows is the only OS that is *always* case-insensitive
|
# Windows is the only OS that is *always* case-insensitive
|
||||||
# (OS X *can* be case-sensitive).
|
# (OS X *can* be case-sensitive).
|
||||||
if sys.platform not in ('win32', 'cygwin'):
|
if sys.platform not in ('win32', 'cygwin'):
|
||||||
changed_name = __file__.upper()
|
changed_name = __file__.upper()
|
||||||
if changed_name == __file__:
|
if changed_name == __file__:
|
||||||
changed_name = __file__.lower()
|
changed_name = __file__.lower()
|
||||||
if os.path.exists(changed_name):
|
if not os.path.exists(changed_name):
|
||||||
return class_
|
CASE_INSENSITIVE_FS = False
|
||||||
else:
|
|
||||||
return unittest.TestCase
|
|
||||||
else:
|
def case_insensitive_tests(test):
|
||||||
return class_
|
"""Class decorator that nullifies tests requiring a case-insensitive
|
||||||
|
file system."""
|
||||||
|
return unittest.skipIf(not CASE_INSENSITIVE_FS,
|
||||||
|
"requires a case-insensitive filesystem")(test)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
Loading…
Reference in New Issue