This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fixed all the doctest failures in Doc/library/configparser.rst
Type: enhancement Stage: patch review
Components: Documentation Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: docs@python Nosy List: brett.cannon, docs@python, marco.buttu, terry.reedy, zach.ware
Priority: normal Keywords: patch

Created on 2016-12-02 22:28 by marco.buttu, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
configparser.patch marco.buttu, 2016-12-02 22:28
configparser2nd.patch marco.buttu, 2016-12-03 19:40
configparser3rd.patch marco.buttu, 2016-12-04 09:23 review
Messages (8)
msg282258 - (view) Author: Marco Buttu (marco.buttu) * Date: 2016-12-02 22:28
With Python 3.7.0a0  and sphinx-build 1.4.9, this was the result before applying the patch:

Doctest summary
===============
   80 tests
    8 failures in tests
    0 failures in setup code
    0 failures in cleanup code
build finished with problems, 139 warnings.

After applaying the patch there are 0 failures in 84 tests. All the doctests also pass with Python 3.6 and 3.5. I skipped three tests (doctest: +SKIP) because their output is random (iterating over dictionary keys).
msg282292 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2016-12-03 18:58
For the iteration of dictionary keys, can you pass the keys through sorted() to have a deterministic order?
msg282297 - (view) Author: Marco Buttu (marco.buttu) * Date: 2016-12-03 19:40
I usually keep the code examples focused, because I think extra code added just in order to have more tests can get the example less clear. But of course, there is an important downside :/ So, if your policy and goal is to have a better coverage of the code examples, here is another patch that uses sorted().

Thank you very much for your time :-)
msg282311 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-12-03 23:26
Marco, thank you for adding more energy to improving the docs. #27200 is the master issue for fixing failing doc doctests.  The goal is to be able to have a buildbot run 'make doctest' or the Windows equivalent and expect success.

For this issue, I mildly agree with Brett.  Adding sorted is something a user might do.  But I am curious what policy Zack followed for the other 9 patches.
msg282312 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-12-03 23:27
For some reason, not obvious to me, these patches cannot be reviewed on Rietveld.
msg282315 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-12-04 05:30
Indeed, thank you Marco for continuing this work!

The patches that I committed [1] were mostly done by Jelle Zijlstra.  There were not many tests that had dict ordering issues; but it looks like we used sorted() rather than list() in a few places.  I think using sorted() here is fine as well (though for the third one, I'd recommend turning the list comprehension into a generator expression argument to sorted, rather than sticking sorted() in the middle of the listcomp).

As far as why these patches are not compatible with Rietveld, they appear to have been generated by `diff` between two discrete files rather than by `hg diff` or `git diff`, and Reitveld can't find the files as named to be able to apply the patch.


[1] Viewable in aggregate here: https://hg.python.org/cpython/rev/769355e031:d0302d8ecbc1
msg282325 - (view) Author: Marco Buttu (marco.buttu) * Date: 2016-12-04 09:23
Here is a 3rd patch. I used a generator expression argument to ``sorted()``, as recommend by Zachary. Thank you very much for all your suggestions
msg282653 - (view) Author: Marco Buttu (marco.buttu) * Date: 2016-12-07 18:49
I attached a patch in issue 27200 that makes all doctests pass, so I close here.
History
Date User Action Args
2022-04-11 14:58:40adminsetgithub: 73046
2016-12-07 18:49:47marco.buttusetstatus: open -> closed
resolution: duplicate
messages: + msg282653
2016-12-04 09:23:17marco.buttusetfiles: + configparser3rd.patch

messages: + msg282325
2016-12-04 05:30:32zach.waresetmessages: + msg282315
stage: patch review
2016-12-03 23:27:48terry.reedysetmessages: + msg282312
2016-12-03 23:26:19terry.reedysetnosy: + terry.reedy, zach.ware
messages: + msg282311
2016-12-03 23:15:24terry.reedylinkissue27200 dependencies
2016-12-03 19:40:44marco.buttusetfiles: + configparser2nd.patch

messages: + msg282297
2016-12-03 18:58:02brett.cannonsetnosy: + brett.cannon
messages: + msg282292
2016-12-02 22:28:32marco.buttucreate