[New-bugs-announce] [issue22567] doctest handle ignored execption

Yoav Caspi report at bugs.python.org
Mon Oct 6 16:06:46 CEST 2014

New submission from Yoav Caspi:

When implementing a class with a __del__ function that raise an exception the exception ignored.
is it possible to add this printed message to be tested by doc test?

something like when running this script the script will pass:
Usage Example:
    >>> cls = Module()
    >>> del cls
    Exception Exception: Exception('oops',) in <bound method Module.__del__ of <__main__.Module object at 0x000000000XXXXXXX>> ignored

class Module(object):
    def __del__(self):
        raise Exception("oops")

if __name__ == '__main__':
    from doctest import testmod
    print testmod()

components: Tests
messages: 228685
nosy: Yoav.Caspi
priority: normal
severity: normal
status: open
title: doctest handle ignored execption
type: enhancement
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list