-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
gh-111704: Add stdtypes.rst to doctests
#136501
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
base: main
Are you sure you want to change the base?
Conversation
|
This is a very interesting case: tests fail on WASI https://github.com/python/cpython/actions/runs/16193074826/job/45713120305?pr=136501 |
|
Can we skip them on WASI? |
|
Done! |
| and are converted into regular :class:`str` objects. | ||
| For example: | ||
|
|
||
| .. doctest:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are all the doctest:: directive removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we now run doctests from test_builtins.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why run from test_builtins instead of make doctest? All the other doctests in documnentation run via Sphinx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of reasons: make doctest is not executed in all environments (which call help us find bugs), it is harder to run locally (slower and requires extra setup), not all >>> are recognized as doctests by make doctest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think though we should maintain the property that documentation doctests are all run via the same mechanism.
not all
>>>are recognized as doctests bymake doctest
Do you have examples? We likely need to add more .. doctest::, rather than removing them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, right in this file. Check out int.bit_length(). It is checked now. Also, check out my AttributeError: 'method' object has no attribute 'whoami' change, it was not caught before :(
Please, help me with this one :)
This
stdtypes.rstPR:>>>to be tested withdoctestin test cases. Because regulardoctestruns all>>>examples, not just ones that are explicitly marked as doctests. Which is benefitial, when we already have lots of code samples.. doctest::to be a regular code, because we don't need to test it twice withsphinx doctestanddoctest📚 Documentation preview 📚: https://cpython-previews--136501.org.readthedocs.build/