summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/util.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-05-11 01:47:11 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-05-11 01:47:11 (GMT)
commit1262e7c7468b6a92a680161c322a0234b526e3db (patch)
tree810d23e94fd2bf85148588e3ec22caf1b0cf79dd /Lib/importlib/test/util.py
parentcc3b8d6883f52391c59f59e82bfa1840e2847d90 (diff)
downloadcpython-1262e7c7468b6a92a680161c322a0234b526e3db.zip
cpython-1262e7c7468b6a92a680161c322a0234b526e3db.tar.gz
cpython-1262e7c7468b6a92a680161c322a0234b526e3db.tar.bz2
Tests for case-senstivity were not being skipped for darwin when installed on a
case-sensitive filesystems -- which is not the default case. Along the way also fixed the skipping of tests when sys.dont_write_bytecode is true. Closes issue #5442 again.
Diffstat (limited to 'Lib/importlib/test/util.py')
-rw-r--r--Lib/importlib/test/util.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/importlib/test/util.py b/Lib/importlib/test/util.py
index 9ff54a2..845e380 100644
--- a/Lib/importlib/test/util.py
+++ b/Lib/importlib/test/util.py
@@ -7,17 +7,18 @@ import sys
def case_insensitive_tests(class_):
- """Class decorator that nullifies tests that require a case-insensitive
+ """Class decorator that nullifies tests requiring a case-insensitive
file system."""
- if sys.platform not in ('win32', 'darwin', 'cygwin'):
- original_name = os.listdir('.')[0]
- if original_name.upper() != original_name:
- changed_name = original_name.upper()
- else:
- changed_name = original_name.lower()
+ # 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_
- return unittest.TestCase
+ else:
+ return unittest.TestCase
else:
return class_