-
-
Notifications
You must be signed in to change notification settings - Fork 34.6k
Decide what should we do with doctests in CI #111704
Copy link
Copy link
Open
Labels
buildThe build process and cross-buildThe build process and cross-builddocsDocumentation in the Doc dirDocumentation in the Doc dirtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
buildThe build process and cross-buildThe build process and cross-builddocsDocumentation in the Doc dirDocumentation in the Doc dirtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Bug report
Initial PR and discussion: #111682
So, here's the problem:
We have two tools:
doctest(builtin module) andsphinx(3rd party) that can run these samples as doctests. The problem is that they define "doctest" term differently:doctestmodule says that both of these examples are doctestssphinxsays that only example with.. doctest::directive is a doctestThis is problematic, because not all example are actually executed in CI, right now we have a CI job that uses Sphinx. So, in the result of this we have broken doctest (1st meaning) examples in the docs.
Examples:
What can we do?
Options:
.. doctest::directives everywhere, but I think it is too much work and people will forget to do thisdoctest_test_doctest_blocks, see docs https://www.sphinx-doc.org/en/master/usage/extensions/doctest.html This is what I plan to do locally and I will send a PR with the results. I fear that quite a lot of doctests might be brokentest_*files using something likeThe last option is also problematic, because right now we can only run doctests in CI, when PR only touches
Doc/folder, I am not sure that it will be easy with this setup.CC @AlexWaygood @AA-Turner
Linked PRs
doctest_test_doctest_blocksoption to Sphinx #111723stdtypes.rstto doctests #136501