mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +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
|
|
@ -9,32 +9,23 @@ import tempfile
|
|||
from test import support
|
||||
|
||||
|
||||
def writes_bytecode(fxn):
|
||||
"""Decorator to protect sys.dont_write_bytecode from mutation."""
|
||||
def writes_bytecode_files(fxn):
|
||||
"""Decorator to protect sys.dont_write_bytecode from mutation and to skip
|
||||
tests that require it to be set to False."""
|
||||
if sys.dont_write_bytecode:
|
||||
return lambda *args, **kwargs: None
|
||||
@functools.wraps(fxn)
|
||||
def wrapper(*args, **kwargs):
|
||||
original = sys.dont_write_bytecode
|
||||
sys.dont_write_bytecode = False
|
||||
to_return = fxn(*args, **kwargs)
|
||||
sys.dont_write_bytecode = original
|
||||
try:
|
||||
to_return = fxn(*args, **kwargs)
|
||||
finally:
|
||||
sys.dont_write_bytecode = original
|
||||
return to_return
|
||||
return wrapper
|
||||
|
||||
|
||||
def writes_bytecode_files(fxn):
|
||||
"""Decorator that returns the function if writing bytecode is enabled, else
|
||||
a stub function that accepts anything and simply returns None."""
|
||||
if sys.dont_write_bytecode:
|
||||
return lambda *args, **kwargs: None
|
||||
else:
|
||||
@functools.wraps(fxn)
|
||||
def wrapper(*args, **kwargs):
|
||||
to_return = fxn(*args, **kwargs)
|
||||
sys.dont_write_bytecode = False
|
||||
return to_return
|
||||
return wrapper
|
||||
|
||||
|
||||
def bytecode_path(source_path):
|
||||
for suffix, _, type_ in imp.get_suffixes():
|
||||
if type_ == imp.PY_COMPILED:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue