summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-07-20 01:05:40 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-07-20 01:05:40 (GMT)
commit4dc3193973101ce278aee58a9ee36cec2451caf4 (patch)
tree26ef22df0d1471f423a59cccd7b2eca5df8bfabe
parent3c2738488ab893017c26e529ee2ebedd41bbb263 (diff)
downloadcpython-4dc3193973101ce278aee58a9ee36cec2451caf4.zip
cpython-4dc3193973101ce278aee58a9ee36cec2451caf4.tar.gz
cpython-4dc3193973101ce278aee58a9ee36cec2451caf4.tar.bz2
Remove custom test-skipping code in importlib tests for unittest code.
-rw-r--r--Lib/importlib/test/util.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/Lib/importlib/test/util.py b/Lib/importlib/test/util.py
index 845e380..0c0c84c 100644
--- a/Lib/importlib/test/util.py
+++ b/Lib/importlib/test/util.py
@@ -6,21 +6,22 @@ import unittest
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
file system."""
- # 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 os.path.exists(changed_name):
- return class_
- else:
- return unittest.TestCase
- else:
- return class_
+ return unittest.skipIf(not CASE_INSENSITIVE_FS,
+ "requires a case-insensitive filesystem")(test)
@contextmanager