From f31637d9545d788f9333d90b6a3d2f5b7a31d1ab Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Mon, 26 Jul 2010 18:47:04 -0400 Subject: Applying stack-frame selection patch from @nvie --- machineout.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/machineout.py b/machineout.py index 83251b0..69a53c6 100644 --- a/machineout.py +++ b/machineout.py @@ -75,7 +75,16 @@ class NoseMachineReadableOutput(Plugin): def addFormatted(self, etype, err): exctype, value, tb = err fulltb = traceback.extract_tb(tb) - fname, lineno, funname, msg = fulltb[-1] + + fallback = fulltb[-1] + try: + while True: + fname, lineno, funname, msg = fulltb.pop() + if fname.startswith(self.basepath): + break + except IndexError: + fname, lineno, funname, msg = fallback + # explicit support for doctests is needed if is_doctest_traceback(fname): # doctest traceback includes pre-formatted error message -- cgit v1.2.3