Skip to content

gh-152236: Fix skips on _testcapi.set_nomemory tests#152253

Merged
sobolevn merged 4 commits into
python:mainfrom
sobolevn:issue-152236
Jun 26, 2026
Merged

gh-152236: Fix skips on _testcapi.set_nomemory tests#152253
sobolevn merged 4 commits into
python:mainfrom
sobolevn:issue-152236

Conversation

@sobolevn

@sobolevn sobolevn commented Jun 26, 2026

Copy link
Copy Markdown
Member

Now all tests that use _testcapi.set_nomemory have all the right skips :)

@sobolevn sobolevn requested a review from vstinner June 26, 2026 08:02
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Jun 26, 2026
@sobolevn sobolevn added skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jun 26, 2026
support.gc_collect()

@support.cpython_only
@unittest.skipIf(support.Py_TRACE_REFS, 'cannot test Py_TRACE_REFS build')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't copy the comment oon Py_TRACE_REFS skip which makes this skip mysterious.

What do you think of adding a decorator to test.support which would do @support.cpython_only + @unittest.skipIf(support.Py_TRACE_REFS) with all needed comments explaining why Py_TRACE_REFS is skipped?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Working on it.

@sobolevn sobolevn requested a review from iritkatriel as a code owner June 26, 2026 11:57

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It looks better with @support.nomemtest decorator!

import_module('_testcapi')
return f(*args, **kwargs)

return unittest.skipIf(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may move the Py_TRACE_REFS comment here.

@sobolevn sobolevn Jun 26, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep it :)
I moved it closer to the Py_TRACE_REFS definition.
It was really helpful for me when I first learned about this skip rule.

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (Ooops, I forgot to select (o) Approve).

@sobolevn

Copy link
Copy Markdown
Member Author

Thank you for your help!

@sobolevn sobolevn enabled auto-merge (squash) June 26, 2026 13:02
@sobolevn sobolevn merged commit 1cbe460 into python:main Jun 26, 2026
91 of 93 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @sobolevn for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152281 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jun 26, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @sobolevn, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 1cbe460eb6c5f40980463f381b3096c92320ff84 3.13

@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152282 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jun 26, 2026
@bedevere-app

bedevere-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

GH-152286 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jun 26, 2026
sobolevn added a commit that referenced this pull request Jun 26, 2026
) (#152282)

gh-152236: Fix skips on `_testcapi.set_nomemory` tests (GH-152253)
(cherry picked from commit 1cbe460)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 26, 2026
) (#152281)

gh-152236: Fix skips on `_testcapi.set_nomemory` tests (GH-152253)
(cherry picked from commit 1cbe460)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this pull request Jun 26, 2026
) (#152286)

* [3.13] gh-152236: Fix skips on `_testcapi.set_nomemory` tests (GH-152253)
(cherry picked from commit 1cbe460)

Co-authored-by: sobolevn <mail@sobolevn.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants