Skip to content

sys.excepthook is not called #535

@nedbat

Description

@nedbat

Originally reported by Andrew Hoos (Bitbucket: andrewhoos, GitHub: andrewhoos)


This file does not call the handle_exception function when it is run through coverage, but it does when called through python. The global exception provides significant functionality that would be great to test. But I can't test with coverage because it disables the exception handler which changes the results of the test in question.

#!python

import sys

def handle_exception(exc_type, exc_value, exc_traceback):  # pragma: no cover
    print('exception')

sys.excepthandler = handle_exception

raise RuntimeError('Raised')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions