Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctest handle ignored execption #66757

Closed
YoavCaspi mannequin opened this issue Oct 6, 2014 · 2 comments
Closed

doctest handle ignored execption #66757

YoavCaspi mannequin opened this issue Oct 6, 2014 · 2 comments
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@YoavCaspi
Copy link
Mannequin

YoavCaspi mannequin commented Oct 6, 2014

BPO 22567
Nosy @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2014-10-06.14:13:57.885>
created_at = <Date 2014-10-06.14:06:46.072>
labels = ['invalid', 'type-feature', 'tests']
title = 'doctest handle ignored execption'
updated_at = <Date 2014-10-06.14:13:57.883>
user = 'https://bugs.python.org/YoavCaspi'

bugs.python.org fields:

activity = <Date 2014-10-06.14:13:57.883>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2014-10-06.14:13:57.885>
closer = 'r.david.murray'
components = ['Tests']
creation = <Date 2014-10-06.14:06:46.072>
creator = 'Yoav.Caspi'
dependencies = []
files = []
hgrepos = []
issue_num = 22567
keywords = []
message_count = 2.0
messages = ['228685', '228686']
nosy_count = 2.0
nosy_names = ['r.david.murray', 'Yoav.Caspi']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue22567'
versions = ['Python 2.7']

@YoavCaspi
Copy link
Mannequin Author

YoavCaspi mannequin commented Oct 6, 2014

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()

@YoavCaspi YoavCaspi mannequin added tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Oct 6, 2014
@bitdancer
Copy link
Member

This tracker is not a place to get answers to questions, you should use the python-list mailing list for that. (That said, here's a hint: the only way to capture that message is to run it in a subprocess; the message is generated asynchronously, during garbage collection.)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant