module pycode.coverage_helper

Short summary

module pyquickhelper.pycode.coverage_helper

Publishing coverage

source on GitHub

Functions

function

truncated documentation

_attr_

coverage_combine

Merges multiples reports.

find_coverage_report

Finds all coverage reports in one subfolder.

get_source

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._attr_(var, name1, name2)[source][source]
pyquickhelper.pycode.coverage_helper.coverage_combine(data_files, output_path, source, process=None)[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

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=None)[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