Skip to content

gh-133210: Fix test_pydoc in --without-doc-strings mode #133271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 2, 2025

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented May 1, 2025

Снимок экрана 2025-05-01 в 20 11 37

Tests now pass with --without-doc-strings and in a regular mode.

self.assertIn(' | __repr__(self, /) from builtins.object', lines)
self.assertIn(' | object_repr = __repr__(self, /)', lines)
else:
self.assertIn(' | count(self, object, /) from builtins.list', lines)
Copy link
Member

Choose a reason for hiding this comment

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

We don't have CI building Python without docstrings, this code path is less well tested. Maybe just remove it and only keep tests when we have C docstrings?

Copy link
Member Author

Choose a reason for hiding this comment

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

In this case we can have unexpected results when python is built without docstrings and no one will ever notice. Plus, this gives an example that you need to think about both modes when writting tests.

I don't think that signature of repr, list.count and list.get without docstrings will change that often.

But, I don't have a strong opinion here for sure, I will make any change that you think is best here

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

Ok, let's keep these tests without docstrings.

@sobolevn sobolevn merged commit 4912b29 into python:main May 2, 2025
50 checks passed
@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 2, 2025
…thonGH-133271)

(cherry picked from commit 4912b29)

Co-authored-by: sobolevn <mail@sobolevn.me>
@bedevere-app
Copy link

bedevere-app bot commented May 2, 2025

GH-133288 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 May 2, 2025
@sobolevn
Copy link
Member Author

sobolevn commented May 2, 2025

Thank you! Working on other modules 👍

sobolevn added a commit that referenced this pull request May 2, 2025
…H-133271) (#133288)

gh-133210: Fix `test_pydoc` in `--without-doc-strings` mode (GH-133271)
(cherry picked from commit 4912b29)

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