Mercurial > cpython-lru_cache-weakref
diff Lib/importlib/test/util.py @ 53996:0495bc47cd08
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.
| author | Brett Cannon <bcannon@gmail.com> |
|---|---|
| date | Mon, 11 May 2009 01:47:11 +0000 |
| parents | fa2aac434d06 |
| children | 5cf68d3b6532 |
line wrap: on
line diff
--- a/Lib/importlib/test/util.py Sun May 10 23:43:14 2009 +0000 +++ b/Lib/importlib/test/util.py Mon May 11 01:47:11 2009 +0000 @@ -7,17 +7,18 @@ 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_
