summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--machineout.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/machineout.py b/machineout.py
index 8a09689..8c0495b 100644
--- a/machineout.py
+++ b/machineout.py
@@ -48,7 +48,8 @@ class NoseMachineReadableOutput(Plugin):
48 48
49 """ 49 """
50 fname, _, funname, _ = frame 50 fname, _, funname, _ = frame
51 score = 0 51 score = 0.0
52 max_score = 7.0 # update this when new conditions are added
52 53
53 # Being in the project directory means it's one of our own files 54 # Being in the project directory means it's one of our own files
54 if fname.startswith(self.basepath): 55 if fname.startswith(self.basepath):
@@ -63,7 +64,7 @@ class NoseMachineReadableOutput(Plugin):
63 # machineout still returns the most useful error line number. 64 # machineout still returns the most useful error line number.
64 if not funname.startswith('assert'): 65 if not funname.startswith('assert'):
65 score += 1 66 score += 1
66 return score 67 return score / max_score
67 68
68 def _selectBestStackFrame(self, traceback): 69 def _selectBestStackFrame(self, traceback):
69 best_score = 0 70 best_score = 0
@@ -73,6 +74,10 @@ class NoseMachineReadableOutput(Plugin):
73 if curr_score > best_score: 74 if curr_score > best_score:
74 best = frame 75 best = frame
75 best_score = curr_score 76 best_score = curr_score
77
78 # Terminate the walk as soon as possible
79 if best_score >= 1:
80 break
76 return best 81 return best
77 82
78 def add_formatted(self, etype, err): 83 def add_formatted(self, etype, err):