mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
print coverage at the end of the test; minor pep8 fixes
This commit is contained in:
parent
a502da63d5
commit
ff36dd1010
@ -61,20 +61,23 @@ class TestCoverageCommand(setuptools.Command):
|
||||
if self.test_module is None:
|
||||
test_suite = tests.TEST_SUITE
|
||||
else:
|
||||
test = unittest.defaultTestLoader.loadTestsFromNames([self.test_module])
|
||||
test = unittest.defaultTestLoader.\
|
||||
loadTestsFromNames([self.test_module])
|
||||
test_suite = unittest.TestSuite(test)
|
||||
|
||||
# run the coverage analysis
|
||||
runner = unittest.TextTestRunner()
|
||||
cov = coverage.coverage(auto_data=True, branch=True, source=SOURCE_DIRS,
|
||||
omit=FILES_TO_OMIT)
|
||||
cov = coverage.coverage(auto_data=True, branch=True,
|
||||
source=SOURCE_DIRS, omit=FILES_TO_OMIT)
|
||||
cov.erase() # erase existing coverage data file
|
||||
cov.start()
|
||||
runner.run(test_suite)
|
||||
cov.stop()
|
||||
|
||||
# generate an HTML report
|
||||
# generate an HTML report and print overall coverage
|
||||
html_report_title = ("FreedomBox:Plinth -- Test Coverage as of " +
|
||||
time.strftime("%x %X %Z"))
|
||||
cov.html_report(directory=COVERAGE_REPORT_DIR, omit=FILES_TO_OMIT,
|
||||
title=html_report_title)
|
||||
_coverage = cov.html_report(directory=COVERAGE_REPORT_DIR,
|
||||
omit=FILES_TO_OMIT,
|
||||
title=html_report_title)
|
||||
print('''\nOverall test coverage: {0:.2f} %\n'''.format(_coverage))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user