[issue28860] Fixed all the doctest failures in Doc/library/configparser.rst
New submission from Marco Buttu: 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). ---------- assignee: docs@python components: Documentation files: configparser.patch keywords: patch messages: 282258 nosy: docs@python, marco.buttu priority: normal severity: normal status: open title: Fixed all the doctest failures in Doc/library/configparser.rst type: enhancement versions: Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file45733/configparser.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Brett Cannon added the comment: For the iteration of dictionary keys, can you pass the keys through sorted() to have a deterministic order? ---------- nosy: +brett.cannon _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Marco Buttu added the comment: 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 :-) ---------- Added file: http://bugs.python.org/file45741/configparser2nd.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Terry J. Reedy added the comment: 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. ---------- nosy: +terry.reedy, zach.ware _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Terry J. Reedy added the comment: For some reason, not obvious to me, these patches cannot be reviewed on Rietveld. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Zachary Ware added the comment: 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 ---------- stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Marco Buttu added the comment: 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 ---------- Added file: http://bugs.python.org/file45745/configparser3rd.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
Marco Buttu added the comment: I attached a patch in issue 27200 that makes all doctests pass, so I close here. ---------- resolution: -> duplicate status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue28860> _______________________________________
participants (4)
-
Brett Cannon
-
Marco Buttu
-
Terry J. Reedy
-
Zachary Ware