Commits

Derek Anderson committed 65c1d72

moved coverage start to handleArgs hook

Comments (0)

Files changed (1)

         self.covSource = event.args.cov_source or self.conSource or ['.']
         self.covReport = event.args.cov_report or self.conReport or ['term']
         self.covConfig = event.args.cov_config or self.conConfig or '.coveragerc'
+        # We need to start coverage here, before tests are loaded.
+        # We don't want to do it if we aren't active.
+        # In the absence of a "postRegistrationEvent" we check self.registered.
+        if self.registered:
+            import cov_core
+            self.covController = cov_core.Central(self.covSource, self.covReport, self.covConfig)
+            self.covController.start()
 
-    def startTestRun(self, event):
-        """Only called if active so start coverage."""
-
-        import cov_core
-        self.covController = cov_core.Central(self.covSource, self.covReport, self.covConfig)
-        self.covController.start()
 
     def afterSummaryReport(self, event):
         """Only called if active so stop coverage and produce reports."""