Skip to content

doctest handle ignored execption #66757

Closed

Description

@YoavCaspi
mannequin
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']

Activity

  1. YoavCaspi commented on Oct 6, 2014

    YoavCaspimannequin
    MannequinAuthor

    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()
  2. added
    testsTests in the Lib/test dir
    type-featureA feature request or enhancement
    on Oct 6, 2014
  3. bitdancer commented on Oct 6, 2014

    @bitdancer
    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.)

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions