Skip to content

Commit

Permalink
coverage filename sometime changes when from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
brownben committed Nov 8, 2024
1 parent f90f312 commit 6d84eb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def should_trace_file(filename):

def line_callback(self, code_object, line_number):
if id(code_object) in self.trace:
self.lines[code_object.co_filename].add(line_number)
lines = self.lines.get(code_object.co_filename)
if lines:
lines.add(line_number)
return sys.monitoring.DISABLE

if Tracer.should_trace_file(code_object.co_filename):
Expand All @@ -37,6 +39,7 @@ def line_callback(self, code_object, line_number):
def get_lines(self):
return dict(self.lines)


tracer = Tracer()

sys.monitoring.use_tool_id(sys.monitoring.COVERAGE_ID, "xc")
Expand Down

0 comments on commit 6d84eb3

Please sign in to comment.