gh-95971: Turn @writes_bytecode_files to skip when not running (#95972)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
Jeong YunWon 2022-10-15 23:57:06 +09:00 committed by GitHub
parent 4e2bd58af4
commit 07b5c4699e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -298,7 +298,7 @@ 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
return unittest.skip("relies on writing bytecode")(fxn)
@functools.wraps(fxn)
def wrapper(*args, **kwargs):
original = sys.dont_write_bytecode