Skip to content

Commit 042df0a

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.15] gh-75876: Use functools.wraps() in test.support test decorators (GH-155262) (#155290)
gh-75876: Use functools.wraps() in test.support test decorators (GH-155262) 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 c3aefdb) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent b8a9987 commit 042df0a

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Lib/test/support/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,7 @@ def bigmemtest(size, memuse, dry_run=True):
12801280
test doesn't support dummy runs when -M is not specified.
12811281
"""
12821282
def decorator(f):
1283+
@functools.wraps(f)
12831284
def wrapper(self):
12841285
size = wrapper.size
12851286
memuse = wrapper.memuse
@@ -1332,6 +1333,7 @@ def internal(*args, **kwargs):
13321333

13331334
def bigaddrspacetest(f):
13341335
"""Decorator for tests that fill the address space."""
1336+
@functools.wraps(f)
13351337
def wrapper(self):
13361338
if max_memuse < MAX_Py_ssize_t:
13371339
if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31:
@@ -1437,6 +1439,7 @@ def no_rerun(reason):
14371439
def deco(func):
14381440
assert not isinstance(func, type), func
14391441
_has_run = False
1442+
@functools.wraps(func)
14401443
def wrapper(self):
14411444
nonlocal _has_run
14421445
if _has_run:

0 commit comments

Comments
 (0)