From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sat, 15 Oct 2022 15:22:38 +0000 (-0700) Subject: gh-95971: Turn @writes_bytecode_files to skip when not running (GH-95972) X-Git-Tag: v3.11.1~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e78d9482a661d700ce889e0f4197e30cf98f32b;p=thirdparty%2FPython%2Fcpython.git gh-95971: Turn @writes_bytecode_files to skip when not running (GH-95972) Co-authored-by: Jelle Zijlstra (cherry picked from commit 07b5c4699e64eb30c3bdcb1275c167e675d37423) Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com> --- diff --git a/Lib/test/test_importlib/util.py b/Lib/test/test_importlib/util.py index c07ac2a64c28..0b6dcc5eaf03 100644 --- a/Lib/test/test_importlib/util.py +++ b/Lib/test/test_importlib/util.py @@ -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