本文整理汇总了Python中coverage.summary.SummaryReporter类的典型用法代码示例。如果您正苦于以下问题:Python SummaryReporter类的具体用法?Python SummaryReporter怎么用?Python SummaryReporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SummaryReporter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: report
def report(
self, morfs=None, show_missing=None, ignore_errors=None,
file=None, # pylint: disable=redefined-builtin
omit=None, include=None, skip_covered=None,
):
"""Write a summary report to `file`.
Each module in `morfs` is listed, with counts of statements, executed
statements, missing statements, and a list of lines missed.
`include` is a list of file name patterns. Files that match will be
included in the report. Files matching `omit` will not be included in
the report.
If `skip_covered` is True, don't report on files with 100% coverage.
Returns a float, the total percentage covered.
"""
self.get_data()
self.config.from_args(
ignore_errors=ignore_errors, report_omit=omit, report_include=include,
show_missing=show_missing, skip_covered=skip_covered,
)
reporter = SummaryReporter(self, self.config)
return reporter.report(morfs, outfile=file)
示例2: report
def report(
self,
morfs=None,
show_missing=True,
ignore_errors=None,
file=None, # pylint: disable=W0622
omit=None,
include=None,
):
"""Write a summary report to `file`.
Each module in `morfs` is listed, with counts of statements, executed
statements, missing statements, and a list of lines missed.
`include` is a list of filename patterns. Modules whose filenames
match those patterns will be included in the report. Modules matching
`omit` will not be included in the report.
Returns a float, the total percentage covered.
"""
self._harvest_data()
self.config.from_args(ignore_errors=ignore_errors, omit=omit, include=include, show_missing=show_missing)
reporter = SummaryReporter(self, self.config)
return reporter.report(morfs, outfile=file)
示例3: report
def report(
self, morfs=None, show_missing=None, ignore_errors=None,
file=None, omit=None, include=None, skip_covered=None,
):
"""Write a textual summary report to `file`.
Each module in `morfs` is listed, with counts of statements, executed
statements, missing statements, and a list of lines missed.
If `show_missing` is true, then details of which lines or branches are
missing will be included in the report. If `ignore_errors` is true,
then a failure while reporting a single file will not stop the entire
report.
`file` is a file-like object, suitable for writing.
`include` is a list of file name patterns. Files that match will be
included in the report. Files matching `omit` will not be included in
the report.
If `skip_covered` is true, don't report on files with 100% coverage.
All of the arguments default to the settings read from the
:ref:`configuration file <config>`.
Returns a float, the total percentage covered.
"""
self.config.from_args(
ignore_errors=ignore_errors, report_omit=omit, report_include=include,
show_missing=show_missing, skip_covered=skip_covered,
)
reporter = SummaryReporter(self, self.config)
return reporter.report(morfs, outfile=file)
示例4: report
def report(self, morfs=None, show_missing=True, ignore_errors=False,
file=None, omit_prefixes=None): # pylint: disable-msg=W0622
"""Write a summary report to `file`.
Each module in `morfs` is listed, with counts of statements, executed
statements, missing statements, and a list of lines missed.
"""
reporter = SummaryReporter(self, show_missing, ignore_errors)
reporter.report(morfs, outfile=file, omit_prefixes=omit_prefixes)
示例5: get_summary_text
def get_summary_text(self, coverage_data, options):
"""Get text output from the SummaryReporter."""
cov = Coverage()
cov.start()
cov.stop() # pragma: nested
cov.data = coverage_data
printer = SummaryReporter(cov, options)
destination = StringIO()
printer.report([], destination)
return destination.getvalue()
示例6: get_summary_text
def get_summary_text(self, options):
"""Get text output from the SummaryReporter."""
self.make_rigged_file("file1.py", 339, 155)
self.make_rigged_file("file2.py", 13, 3)
self.make_rigged_file("file3.py", 234, 228)
self.make_file("doit.py", "import file1, file2, file3")
cov = Coverage(source=["."], omit=["doit.py"])
cov.start()
import doit # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
printer = SummaryReporter(cov, options)
destination = StringIO()
printer.report([], destination)
return destination.getvalue()
示例7: ProgressionReporter
class ProgressionReporter(CoverageReporter):
"""A reporter for testing whether your coverage is improving or degrading. """
def __init__(self, coverage, show_missing=False, ignore_errors=False):
super(ProgressionReporter, self).__init__(coverage, ignore_errors)
self.summary_reporter = CoverageSummaryReporter(coverage, show_missing=show_missing, ignore_errors=ignore_errors)
def coverage_progressed(self):
""" Returns 0 if coverage has regressed, 1 if there was no
existing best-coverage summary, 2 if coverage is the same as
the existing best-coverage summary, 3 if coverage is improved
compared to the existing best-coverage summary. """
if not hasattr(self, 'bestunc'):
return 1
if (self.curtot == self.besttot) and (self.curunc == self.bestunc):
return 2
if (self.curtot <= self.besttot) and (self.curunc <= self.bestunc):
return 3
else:
return 0
def report(self, morfs, omit=None, outfile=None, include=None):
"""Writes a report summarizing progression/regression."""
# First we use our summary_reporter to generate a text summary of the current version.
if outfile is None:
outfile = SUMMARY_FNAME
outfileobj = open(outfile, "w")
self.summary_reporter.report(morfs, omit=omit, outfile=outfileobj, include=include)
outfileobj.close()
self.curunc, self.curpart = parse_out_unc_and_part(fileutil.read_file(SUMMARY_FNAME, mode='rU'))
self.curtot = self.curunc + self.curpart
# Then we see if there is a previous best version and if so what its count of uncovered and partially covered lines was.
try:
self.bestunc, self.bestpart = parse_out_unc_and_part(fileutil.read_file(BEST_SUMMARY_FNAME, mode='rU'))
except IOError, le:
# Ignore "No such file or directory", report and ignore any other error.
if (le.args[0] != 2 and le.args[0] != 3) or (le.args[0] != errno.ENOENT):
sys.stderr.write("WARNING, got unexpected IOError from attempt to read best-ever summary file: %s\n" % (le,))
pass
except SummaryTextParseError, le:
sys.stderr.write("WARNING, got unexpected SummaryTextParseError from attempt to read best-ever summary file: %s\n" % (le,))
pass
示例8: report
def report(self, morfs=None, show_missing=True, ignore_errors=None,
file=None, # pylint: disable-msg=W0622
omit=None, include=None
):
"""Write a summary report to `file`.
Each module in `morfs` is listed, with counts of statements, executed
statements, missing statements, and a list of lines missed.
`include` is a list of filename patterns. Modules whose filenames
match those patterns will be included in the report. Modules matching
`omit` will not be included in the report.
"""
self.config.from_args(
ignore_errors=ignore_errors, omit=omit, include=include
)
reporter = SummaryReporter(
self, show_missing, self.config.ignore_errors
)
reporter.report(morfs, outfile=file, config=self.config)
示例9: __init__
def __init__(self, coverage, show_missing=False, ignore_errors=False):
super(ProgressionReporter, self).__init__(coverage, ignore_errors)
self.summary_reporter = CoverageSummaryReporter(coverage, show_missing=show_missing, ignore_errors=ignore_errors)
示例10: report
def report(self, morfs = None, show_missing = True, ignore_errors = None, file = None, omit = None, include = None):
self._harvest_data()
self.config.from_args(ignore_errors=ignore_errors, omit=omit, include=include, show_missing=show_missing)
reporter = SummaryReporter(self, self.config)
return reporter.report(morfs, outfile=file)