diff options
author | Mike Crute <mcrute@gmail.com> | 2010-07-26 18:47:04 -0400 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-07-26 18:47:04 -0400 |
commit | f31637d9545d788f9333d90b6a3d2f5b7a31d1ab (patch) | |
tree | 512d6b0d3b1c1715c9c90f80de3d15276bd686f8 | |
parent | 65f0f01b8a6d73fd505e572a53324ad58a713dcf (diff) | |
download | nose-machineout-f31637d9545d788f9333d90b6a3d2f5b7a31d1ab.tar.bz2 nose-machineout-f31637d9545d788f9333d90b6a3d2f5b7a31d1ab.tar.xz nose-machineout-f31637d9545d788f9333d90b6a3d2f5b7a31d1ab.zip |
Applying stack-frame selection patch from @nvie
-rw-r--r-- | machineout.py | 11 |
1 files changed, 10 insertions, 1 deletions
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): | |||
75 | def addFormatted(self, etype, err): | 75 | def addFormatted(self, etype, err): |
76 | exctype, value, tb = err | 76 | exctype, value, tb = err |
77 | fulltb = traceback.extract_tb(tb) | 77 | fulltb = traceback.extract_tb(tb) |
78 | fname, lineno, funname, msg = fulltb[-1] | 78 | |
79 | fallback = fulltb[-1] | ||
80 | try: | ||
81 | while True: | ||
82 | fname, lineno, funname, msg = fulltb.pop() | ||
83 | if fname.startswith(self.basepath): | ||
84 | break | ||
85 | except IndexError: | ||
86 | fname, lineno, funname, msg = fallback | ||
87 | |||
79 | # explicit support for doctests is needed | 88 | # explicit support for doctests is needed |
80 | if is_doctest_traceback(fname): | 89 | if is_doctest_traceback(fname): |
81 | # doctest traceback includes pre-formatted error message | 90 | # doctest traceback includes pre-formatted error message |