[Python-checkins] r74106 - python/branches/py3k/Lib/importlib/test/util.py

brett.cannon python-checkins at python.org
Mon Jul 20 03:05:40 CEST 2009


Author: brett.cannon
Date: Mon Jul 20 03:05:40 2009
New Revision: 74106

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


Modified:
   python/branches/py3k/Lib/importlib/test/util.py

Modified: python/branches/py3k/Lib/importlib/test/util.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/util.py	(original)
+++ python/branches/py3k/Lib/importlib/test/util.py	Mon Jul 20 03:05:40 2009
@@ -6,21 +6,22 @@
 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


More information about the Python-checkins mailing list