diff options
Diffstat (limited to 'Lib/importlib/test/util.py')
-rw-r--r-- | Lib/importlib/test/util.py | 17 |
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_ |