Reference

Contents

Index

ExtendedLocalCoverage.generate_html_reportMethod
generate_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.
source
ExtendedLocalCoverage.generate_package_coverageFunction
generate_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.

Keyword arguments (and their defaults)

  • use_existing_lcov = false if true, the coverage is assumed to be already computed and available in coverage/lcov.info within the package directory. If false, the coverage is generated from scratch calling LocalCoverage.generate_coverage.

  • run_test = true this is forwarded to LocalCoverage.generate_coverage and determines whether tests are executed. When false, test execution step is skipped allowing an easier use in combination with other test packages.

  • test_args = [""] this is forwarded to LocalCoverage.generate_coverage and is there passed on to Pkg.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 which occursin(needle, filename) returns true, where needle is any element of exclude.

  • 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 the coverage 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 to html_name, no cobertura XML file is generated. The file is always generated in the coverage 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 the lcov.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 when true, also tries to add to the coverage files in the ext directory that match an extension name specified in the Project.toml file.

Return values

The function returns a named tuple with the following fields:

  • cov the coverage summary as returned by LocalCoverage.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.
source