Avoid a nose bug when running under the test suite and no exception is in

flight.
This commit is contained in:
Barry Warsaw 2015-01-26 12:36:13 -05:00
parent 43325f741a
commit ebd210a6da

View File

@ -1236,8 +1236,15 @@ def logexc(log, msg, *args):
# coming out to a non-debug stream
if msg:
log.warn(msg, *args)
# Debug gets the full trace
log.debug(msg, exc_info=1, *args)
# Debug gets the full trace. However, nose has a bug whereby its
# logcapture plugin doesn't properly handle the case where there is no
# actual exception. To avoid tracebacks during the test suite then, we'll
# do the actual exc_info extraction here, and if there is no exception in
# flight, we'll just pass in None.
exc_info = sys.exc_info()
if exc_info == (None, None, None):
exc_info = None
log.debug(msg, exc_info=exc_info, *args)
def hash_blob(blob, routine, mlen=None):