On this page
trace.CoverageResults
Up: trace | Next: trace.Trace
Rel: trace.Trace
Ref: docs.python.org — trace.CoverageResults
Tags: #public #python3 #stdlib #trace
Import
import trace
from trace import CoverageResults
Signature & Overview
trace.CoverageResults(counts=None, calledfuncs=None, infile=None, callers=None, outfile=None)
trace.CoverageResults class.
Methods & Attributes
CoverageResults.is_ignored_filename(self, filename)— Return True if the filename does not refer to a file we want to have reported.CoverageResults.update(self, other)— Merge in the data from another CoverageResultsCoverageResults.write_results(self, show_missing=True, summary=False, coverdir=None, *, ignore_missing_files=False)— Write the coverage results.CoverageResults.write_results_file(self, path, lines, lnotab, lines_hit, encoding=None)— Return a coverage results file in path.
Usage
import trace
tr = trace.Trace(count=True, trace=False)
tr.runfunc(lambda: sum(range(5)))
res = tr.results()
assert isinstance(res, trace.CoverageResults) and len(res.counts) > 0
Gotchas
- Use
res.write_results(show_missing=True)to inspect hit counts; for real CI coverage, usecoverage.py.
REPL Inspect
from trace import CoverageResults
help(CoverageResults)
Linked from
Related notes
- tuts/python3/stdlib_module/trace/Trace Linked here; links to this page; shared tags: #stdlib, #trace
- tuts/python3/stdlib_module/trace links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib
- tuts/c/stdlib/ctype/isdigit shared tags: #stdlib
- tuts/c/stdlib/ctype/isspace shared tags: #stdlib