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.

Author Brainix
Recipients Brainix, docs@python
Date 2016-11-17.01:19:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1479345580.78.0.277825169146.issue28722@psf.upfronthosting.co.za>
In-reply-to
Content
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!
History
Date User Action Args
2016-11-17 01:19:41Brainixsetrecipients: + Brainix, docs@python
2016-11-17 01:19:40Brainixsetmessageid: <1479345580.78.0.277825169146.issue28722@psf.upfronthosting.co.za>
2016-11-17 01:19:40Brainixlinkissue28722 messages
2016-11-17 01:19:37Brainixcreate