Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Jul 10, 2025

Please, help me with this one :)

This stdtypes.rst PR:

  • Enables more >>> to be tested with doctest in test cases. Because regular doctest runs all >>> examples, not just ones that are explicitly marked as doctests. Which is benefitial, when we already have lots of code samples
  • Refactors .. doctest:: to be a regular code, because we don't need to test it twice with sphinx doctest and doctest

📚 Documentation preview 📚: https://cpython-previews--136501.org.readthedocs.build/

@sobolevn
Copy link
Member Author

sobolevn commented Jul 10, 2025

This is a very interesting case: tests fail on WASI https://github.com/python/cpython/actions/runs/16193074826/job/45713120305?pr=136501

@hugovk
Copy link
Member

hugovk commented Aug 8, 2025

Can we skip them on WASI?

@sobolevn
Copy link
Member Author

Done!

and are converted into regular :class:`str` objects.
For example:

.. doctest::
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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 by make doctest

Do you have examples? We likely need to add more .. doctest::, rather than removing them.

Copy link
Member Author

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 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants