Reference
Contents
Index
ExtendedLocalCoverage.generate_html_report
— Methodgenerate_html_report(cobertura_file, html_file; title = nothing, pkg_dir = nothing)
Generate an HTML report from a cobertura XML file using the pycobertura
Python package.
The cobertura_file
and html_file
arguments are the full paths to the cobertura XML file used as input and of the HTML file to be generated, respectively.
Keyword arguments
title = "Package Coverage Report"
is the title used at the top of the HTML report.pkg_dir = dirname(cobertura_file)
is the directory of the package being covered. It is used to generate the source code links in the HTML report and by default assumes the package directory to be the directory of the cobertura XML file.
ExtendedLocalCoverage.generate_package_coverage
— Functiongenerate_package_coverage(pkg = nothing; kwargs...)
Generate a summary of coverage results for package pkg
.
If no pkg
is supplied, the method operates in the currently active package. This acts similary to (and based on) the generate_coverage
function from LocalCoverage.jl, but providing two main differences:
- It automatically extracts the list of files included by the package using
Revise.parse_pkg_files
. - It allows to generate an HTML report (does so by default) using the
pycobertura
Python package which is installed by default via CondaPkg.- In contrast, the HTML report from
LocalCoverage.jl
relies on lcov being already available on your system and does not work on Windows machines.
- In contrast, the HTML report from
Keyword arguments (and their defaults)
use_existing_lcov = false
if true, the coverage is assumed to be already computed and available incoverage/lcov.info
within the package directory. If false, the coverage is generated from scratch callingLocalCoverage.generate_coverage
.run_test = true
this is forwarded toLocalCoverage.generate_coverage
and determines whether tests are executed. Whenfalse
, test execution step is skipped allowing an easier use in combination with other test packages.test_args = [""]
this is forwarded toLocalCoverage.generate_coverage
and is there passed on toPkg.test
.exclude = []
is used to specify string or regexes that are used to filter out some of the files in the list of package includes. The exclusion is done by removing from the list of files all files for whichoccursin(needle, filename)
returnstrue
, whereneedle
is any element ofexclude
.html_name = "index.html"
is the name of the HTML file to be generated. If nothing is provided, no HTML report is generated. The report is always generated in thecoverage
subdirectory of the target package directory.cobertura_name = "cobertura-coverage.xml"
is the name of the cobertura XML file to be generated. If nothing is provided both to this kwarg and tohtml_name
, no cobertura XML file is generated. The file is always generated in thecoverage
subdirectory of the target package directory.print_to_stdout = true
determines whether the coverage summary is printed to the standard output.force_paths_relative = false
determines whether the paths in thelcov.info
file are processed to make sure they are relative to the package directory. This is needed in some corner cases, especially if one wants the html file to correctly show source code for the files in the report.extensions = true
whentrue
, also tries to add to the coverage files in theext
directory that match an extension name specified in theProject.toml
file.
Return values
The function returns a named tuple with the following fields:
cov
the coverage summary as returned byLocalCoverage.generate_coverage
.cobertura_file
the full path to the cobertura XML file, if any was generated.html_file
the full path to the HTML file, if any was generated.