From a2a8f9a110799fc3f2900850c0e64a4015e15f70 Mon Sep 17 00:00:00 2001 From: Adrien Di Mascio Date: Thu, 22 Jan 2009 11:10:33 +0100 Subject: [testlib] fix bug in traceback formatting: handle cases where we source code is not available --- testlib.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testlib.py b/testlib.py index 15d2df3..55c809b 100644 --- a/testlib.py +++ b/testlib.py @@ -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 = '' + else: + source = ''.join(ctx) if colorize: filename = textutils.colorize_ansi(filename, 'magenta') source = colorize_source(source) -- cgit v1.2.1