[New-bugs-announce] [issue28722] doctest example exit status

Rajiv Bakulesh Shah report at bugs.python.org
Wed Nov 16 20:19:40 EST 2016


New submission from Rajiv Bakulesh Shah:

It might be nice if the doctest example set the appropriate exit status.  Apologies if this is beyond the scope of the example, but I thought it might be good practice.

Here is the file:
https://github.com/python/cpython/blob/master/Doc/library/doctest.rst

Here is the example as written:
if __name__ == "__main__":
    import doctest
    doctest.testmod()

Here is my proposal:
if __name__ == '__main__':
    import doctest
    import sys
    results = doctest.testmod()
    sys.exit(bool(results.failed))

I'm happy to fork the repo and submit a PR, if that makes things easier.  I'm not familiar with the protocol here.  Thanks for the great work!

----------
assignee: docs at python
components: Documentation
messages: 281015
nosy: Brainix, docs at python
priority: normal
severity: normal
status: open
title: doctest example exit status
versions: Python 3.6

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


More information about the New-bugs-announce mailing list