def post_run(self, runner): """ Creates a coverage report in HTML """ #generate html for coverage reportPath = os.path.join(runner.setupDir, 'report', 'jscoverage') genOutput = commands.getstatusoutput( "genhtml -o %s %s" % (reportPath, os.path.join(reportPath, '%s-coverage.dat' % JSTEST_CFG_FILE))) self.coverageDir = reportPath if genOutput[1].find("genhtml") > -1: BaseTestRunner._error("JS Unit Tests - html coverage " "generation failed, genhtml needs to be " "in your PATH. (%s)\n" % genOutput[1]) else: BaseTestRunner._info("JS Coverage - report generated\n") # open a browser window with the report openBrowser(runner.config.getBrowserPath(), os.path.join( reportPath, "index.html"))
def write_report(self, runner, fileName, content): """ Open the browser or write an actual report, depending on the state of the option """ if self.value: self.tmpFile.close() # open a browser window with the report openBrowser(runner.config.getBrowserPath(), self.tmpFile.name) else: # for non-html output, use the normal mechanisms runner.writeNormalReport(fileName, content)
def post_run(self, runner): """ stops figleaf and returns a report """ figleaf.stop() coverageOutput = figleaf.get_data().gather_files() self.coverageDir = os.path.join(runner.setupDir, 'report', 'pycoverage') # check if there's a dir first if not os.path.exists(self.coverageDir): os.mkdir(self.coverageDir) figleaf.annotate_html.report_as_html(coverageOutput, self.coverageDir, [], {}) # open a browser window with the report openBrowser(runner.config.getBrowserPath(), os.path.join( self.coverageDir, "index.html"))