pysys.writer.coverage¶
Writers that collect and report on code coverage data.
PythonCoverageWriter¶
-
class
pysys.writer.coverage.PythonCoverageWriter(logfile=None, **kwargs)[source]¶ Bases:
pysys.writer.testoutput.CollectTestOutputWriterWriter that collects Python code coverage files in a single directory and writes a coverage report during runner cleanup. Requires the “coverage.py” library to be installed.
To enable this, run with
-XcodeCoverage(or-XpythonCoverage) and configure thedestDirplugin property in pysysproject.xml (e.g. to__coverage_python.${outDirName}).If coverage is generated, the directory containing all coverage files is published as an artifact named “PythonCoverageDir”. Optionally an archive of this directory can be generated by setting the
destArchiveproperty (seeCollectTestOutputWriter), and published as “PythonCoverageArchive”.Note that to maintain compatibility with pre-1.6.0 projects, a PythonCoverageWriter instance will be _automatically_ added to the project if the
pythonCoverageDirproject property is set and none is explicitly configured; but the automatic addition is deprecated so you should explicity add this writer to your project if you need it.New in version 1.6.0.
The following properties can be set in the project configuration for this writer (and see also
pysys.writer.testoutput.CollectTestOutputWriterfor inherited properties such asdestArchivewhich produces a .zip of the destDir andincludeTestIffor limiting collection to only unit/smoke tests):-
pythonCoverageArgs= ''¶ A string of command line arguments used to customize the
coverage runandcoverage htmlcommands. Use “…” double quotes around any arguments that contain spaces.For example:
<property name="pythonCoverageArgs" value="--rcfile=${testRootDir}/python_coveragerc"/>
-
includeCoverageFromPySysProcess= False¶ Set this to True to enable measuring coverage for this process (i.e. PySys), rather than only child Python processes. This is useful for testing PySys plugins.
New in version 2.0.
-