1. Julian Berman
  2. coverage.py

Commits

Brett Cannon  committed dc20a17

Make fullcoverage at least run (doesn't work though).

  • Participants
  • Parent commits dd35aee
  • Branches default

Comments (0)

Files changed (2)

File coverage/collector.py

View file
         """The trace function passed to sys.settrace."""
 
         #print("trace event: %s %r @%d" % (
-        #           event, frame.f_code.co_filename, frame.f_lineno))
+        #           event, frame.f_code.co_filename, frame.f_lineno),
+        #      file=sys.stderr)
 
         if self.last_exc_back:
             if frame == self.last_exc_back:
         if self._collectors:
             self._collectors[-1].pause()
         self._collectors.append(self)
-        #print >>sys.stderr, "Started: %r" % self._collectors
+        #print("Started: %r" % self._collectors, file=sys.stderr)
 
         # Check to see whether we had a fullcoverage tracer installed.
-        traces0 = None
+        traces0 = []
         if hasattr(sys, "gettrace"):
             fn0 = sys.gettrace()
             if fn0:
         # Install the tracer on this thread.
         fn = self._start_tracer()
 
-        if traces0:
-            for args in traces0:
-                (frame, event, arg), lineno = args
-                fn(frame, event, arg, lineno=lineno)
+        for args in traces0:
+            fn(*args)
 
         # Install our installation tracer in threading, to jump start other
         # threads.

File coverage/fullcoverage/encodings.py

View file
         self.traces = []
 
     def fullcoverage_trace(self, *args):
-        frame, event, arg = args
-        self.traces.append((args, frame.f_lineno))
+        self.traces.append(args)
         return self.fullcoverage_trace
 
 sys.settrace(FullCoverageTracer().fullcoverage_trace)
 # happen last, since all of the symbols in this module will become None
 # at that exact moment, including "sys".
 
-parentdirs = [ d for d in sys.path if __file__.startswith(d) ]
-parentdirs.sort(key=len)
+parentdirs = sorted(filter(__file__.startswith, sys.path), key=len)
 sys.path.remove(parentdirs[-1])
 del sys.modules['encodings']
 import encodings