module pycode.coverage_helper

Short summary

module pyquickhelper.pycode.coverage_helper

Publishing coverage

source on GitHub

Functions

function

truncated documentation

coverage_combine

Merges multiples reports.

find_coverage_report

Finds all coverage reports in one subfolder.

publish_coverage_on_codecov

Publishes the coverage report on codecov. See blog post 2016-01-01 Badge for coverage.

Documentation

Publishing coverage

source on GitHub

pyquickhelper.pycode.coverage_helper.coverage_combine(data_files, output_path, source, process=None, absolute_path=True, remove_unexpected_root=True)[source][source]

Merges multiples reports.

Parameters
  • data_files – report files (.coverage)

  • output_path – output path

  • source – source directory

  • process – function which processes the coverage report

  • absolute_path – relocate sources with absolute paths

  • remove_unexpected_root – tries to deal with the case where coverage reports store absolute paths of the same source from different folders, the function assumes the last subfolder of source is part of the filename in merged reports.

Returns

coverage report

The function process should have the signature:

def process(content):
    # ...
    return content

On Windows, file name have to have the right case. If not, coverage reports an empty coverage and raises an exception.

Changed in version 1.8: Parameter remove_unexpected_root was added. The function was refactored to handle better relative files.

source on GitHub

pyquickhelper.pycode.coverage_helper.find_coverage_report(folder, exclude=None, filter_out='.*conda.*')[source][source]

Finds all coverage reports in one subfolder.

Parameters
  • folder – which folder to look at

  • exclude – list of subfolder not to look at

  • filter_out – filter out from the name

Returns

list of files .coverage

The structure is supposed to:

folder
  +- hash1
  |    +- date1
  |    |    +- .coverage - not selected
  |    +- date2
  |         +- .coverage - selected
  +- hash2
       +- date
            +- .coverage - selected

source on GitHub

pyquickhelper.pycode.coverage_helper.publish_coverage_on_codecov(path, token, commandline=True, fLOG=<function noLOG>)[source][source]

Publishes the coverage report on codecov. See blog post 2016-01-01 Badge for coverage.

Parameters
  • path – path to source

  • token – token on codecov

  • commandline – see SourceRepository

  • fLOG – logging function

Returns

out, err from function run_cmd

source on GitHub