From ded5dbb2fbade43c53e774a590cdd77dcf09430a Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Sun, 14 Aug 2022 06:46:37 +0900 Subject: [PATCH 1/2] gh-95971: Turn @writes_bytecode_files to skip when not running --- Lib/test/test_importlib/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_importlib/util.py b/Lib/test/test_importlib/util.py index c07ac2a64c289f..765c26bc811ac6 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(fxn) @functools.wraps(fxn) def wrapper(*args, **kwargs): original = sys.dont_write_bytecode From dd1a1a088cd34637c1dd409c9472ef59b63e5243 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 11 Oct 2022 19:39:42 -0700 Subject: [PATCH 2/2] Update Lib/test/test_importlib/util.py --- Lib/test/test_importlib/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_importlib/util.py b/Lib/test/test_importlib/util.py index 765c26bc811ac6..0b6dcc5eaf03d2 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 unittest.skip(fxn) + return unittest.skip("relies on writing bytecode")(fxn) @functools.wraps(fxn) def wrapper(*args, **kwargs): original = sys.dont_write_bytecode