Anonymous avatar Anonymous committed f41ddea

Improved profiler output

Comments (0)

Files changed (1)

nose2/plugins/prof.py

             return
         self.createPfile()
         self.prof = hotshot.Profile(self.pfile)
-        self.suite = event.suite
-        event.suite = self.runProf
+        event.executeTests = self.prof.runcall
 
     def runProf(self, result):
         self.prof.runcall(self.suite, result)
 
-    def stopTestRun(self, event):
+    def beforeSummaryReport(self, event):
         if not hotshot:
             return
         # write prof output to stream
         class Stream:
             def write(self, *msg):
                 for m in msg:
-                    event.message(unicode(m), (1, 2))
-                    event.message(u' ', (1, 2))
+                    event.message(unicode(m), (0, 1, 2))
+                    event.message(u' ', (0, 1, 2))
         stream = Stream()
         self.prof.close()
         prof_stats = stats.load(self.pfile)
         prof_stats.sort_stats(self.sort)
-        event.message("\n\nProfiling results\n", (1, 2))
+        result = event.result
+        if hasattr(result, 'separator1'):
+            event.message(result.separator1, (0, 1, 2))
+        event.message("\nProfiling results\n", (0, 1, 2))
+        if hasattr(result, 'separator2'):
+            event.message(result.separator2, (0, 1, 2))
         compat_25 = hasattr(prof_stats, 'stream')
         if compat_25:
             tmp = prof_stats.stream
             else:
                 sys.stdout = tmp
         self.prof.close()
+        event.message("\n", (0, 1, 2))
+
         if self.clean:
             if self.fileno:
                 try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.