gh-135272: Activate doctests on turtle module - #138877
Conversation
|
This PR is stale because it has been open for 30 days with no activity. |
|
The doctests are already run as part of the CI by Sphinx? I don't see why we need to run them again, especially with the complications it introduces. |
I think no. Because several doctests are wrong. The CI should catch them. And how do I run it locally? |
It definitely does run, e.g. see https://github.com/python/cpython/actions/runs/33099727409/job/98614039426?pr=156485 which runs on "Document: library/turtle" with "324 passed" tests and no failures.
Run |
This PR is a WIP to fix #135272
I'd like reviews and comments before I continue.
Also, I need some help:
I added a
load_testsfunction to include doctests in unittest, and already fixed some ERRORs on tests (8 remaining), the majority were just addingimport turtleand instantiating aturtleobject. Is it possible to avoid repeating it in every doctest?I mocked the
mainloopfunction. But maybe it was the right way. How is it?Any recommendations about how to mock other functions that wait for a user action (num/textinput, ...)?
The
optionflags=doctest.ELLIPSIS|doctest.NORMALIZE_WHITESPACE,options seem not to work properly. For instance,(0,0)is saw different of(0, 0)(common on tests with position()). (Or I did understand how these options work.This PR is related to #111704