Skip to content

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

Merged
sobolevn merged 1 commit intopython:mainfrom
sobolevn:issue-133210-pydoc
May 2, 2025
Merged

gh-133210: Fix test_pydoc in --without-doc-strings mode#133271
sobolevn merged 1 commit intopython:mainfrom
sobolevn:issue-133210-pydoc

Conversation

@sobolevn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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>
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
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