sys.excepthook is not called · Issue #535 · nedbat/coveragepy (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@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')