File tree 1 file changed +7
-4
lines changed
hypothesis-python/src/hypothesis/internal 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -31,20 +31,23 @@ def should_trace_file(fname):
31
31
32
32
33
33
class Tracer :
34
- """A super-simple line coverage tracer."""
34
+ """A super-simple branch coverage tracer."""
35
+
36
+ __slots__ = ("branches" , "_previous_location" )
35
37
36
38
def __init__ (self ):
37
39
self .branches = set ()
38
- self .prev = None
40
+ self ._previous_location = None
39
41
40
42
def trace (self , frame , event , arg ):
41
43
if event == "call" :
42
44
return self .trace
43
45
elif event == "line" :
44
46
fname = frame .f_code .co_filename
45
47
if should_trace_file (fname ):
46
- self .branches .add ((self .prev , (fname , frame .f_lineno )))
47
- self .prev = (fname , frame .f_lineno )
48
+ current_location = (fname , frame .f_lineno )
49
+ self .branches .add ((self ._previous_location , current_location ))
50
+ self ._previous_location = current_location
48
51
49
52
50
53
def get_explaining_locations (traces ):
You can’t perform that action at this time.
0 commit comments