diff options
author | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2009-01-22 11:10:33 +0100 |
---|---|---|
committer | Adrien Di Mascio <Adrien.DiMascio@logilab.fr> | 2009-01-22 11:10:33 +0100 |
commit | a2a8f9a110799fc3f2900850c0e64a4015e15f70 (patch) | |
tree | 3381b561454690a9010a01ab590ec55232cd1d15 | |
parent | 7690afc3825e2582934421850d20a922d9370b9a (diff) | |
download | logilab-common-a2a8f9a110799fc3f2900850c0e64a4015e15f70.tar.gz |
[testlib] fix bug in traceback formatting: handle cases where we source code is not available
-rw-r--r-- | testlib.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -392,7 +392,10 @@ class SkipAwareTestResult(unittest._TextTestResult): if not (0 < index <= nb_frames_skipped): continue filename = osp.abspath(filename) - source = ''.join(ctx) + if ctx is None: # pyc files or C extensions for instance + source = '<no source available>' + else: + source = ''.join(ctx) if colorize: filename = textutils.colorize_ansi(filename, 'magenta') source = colorize_source(source) |