[issue27200] make doctest in CPython has failures

Marco Buttu report at bugs.python.org
Sun Dec 4 05:53:43 EST 2016


Marco Buttu added the comment:

Here is a patch that makes all Doc/library/datetime.rst doctests pass. The tests only pass with Python 3.6 and 3.7 (the optional ``timespec`` argument of ``datetime.isoformat()`` has been introduced in Python 3.6).

To apply the patch you should agree with issue 28863. In particular, to make the patch effective, as explained in issue 28863, you should:

* apply the Doc/conf.py patch of issue 28863.
* rename Doc/includes/tzinfo-examples.py to Doc/includes/tzinfo_examples.py

About the Raymond disappointment expressed in #10225, I see two ways to make both Raymond happy and the code examples tested. For the examples included from Doc/includes, using the ``literalinclude`` Sphinx directive, we can just add the Doc/includes path in Doc/conf.py (see issue 28863). At this point we can import them in the shell code examples (or in the ``setupcode``). In the datetime.rst.patch in attachment, I make use of this solution. Another option, for short snippets of code, not included from Doc/includes, is to use the ``testcode`` Sphinx directive.

----------
keywords: +patch
nosy: +marco.buttu
Added file: http://bugs.python.org/file45747/datetime.rst.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27200>
_______________________________________


More information about the Python-bugs-list mailing list