mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
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.
This commit is contained in:
parent
cc3b8d6883
commit
1262e7c746
7 changed files with 46 additions and 45 deletions
|
@ -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_
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue