https://github.com/python/cpython/commit/3cbed1e7bc9bdf969aa1aaba3fcff9f8c5eec2a1
commit: 3cbed1e7bc9bdf969aa1aaba3fcff9f8c5eec2a1
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-08-07T18:17:30+03:00
summary:

[3.14] gh-75876: Use functools.wraps() in test.support test decorators 
(GH-155262) (GH-155291)

bigmemtest(), bigaddrspacetest() and no_rerun() returned a wrapper named
"wrapper", so a decorator applied on top of them could not identify the test.
(cherry picked from commit c3aefdb9eff0734058376b96fc86d89b1a345d75)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

files:
M Lib/test/support/__init__.py

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 504a0ffb4010bc..eb32e0b059462a 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1193,6 +1193,7 @@ def bigmemtest(size, memuse, dry_run=True):
     test doesn't support dummy runs when -M is not specified.
     """
     def decorator(f):
+        @functools.wraps(f)
         def wrapper(self):
             size = wrapper.size
             memuse = wrapper.memuse
@@ -1245,6 +1246,7 @@ def internal(*args, **kwargs):
 
 def bigaddrspacetest(f):
     """Decorator for tests that fill the address space."""
+    @functools.wraps(f)
     def wrapper(self):
         if max_memuse < MAX_Py_ssize_t:
             if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
@@ -1350,6 +1352,7 @@ def no_rerun(reason):
     def deco(func):
         assert not isinstance(func, type), func
         _has_run = False
+        @functools.wraps(func)
         def wrapper(self):
             nonlocal _has_run
             if _has_run:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to