How to use the pycobertura.cli.ExitCodes.OK function in pycobertura

To help you get started, we’ve selected a few pycobertura examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aconrad / pycobertura / tests / test_cli.py View on Github external
def test_diff__better_coverage_has_exit_status_of_zero():
    from pycobertura.cli import diff, ExitCodes

    runner = CliRunner()
    result = runner.invoke(diff, [
        'tests/dummy.original.xml',
        'tests/dummy.original-full-cov.xml',  # has no uncovered lines
        '--no-source',
    ], catch_exceptions=False)
    assert result.exit_code == ExitCodes.OK
github aconrad / pycobertura / pycobertura / cli.py View on Github external
def get_exit_code(differ, source):
    # Compute the non-zero exit code. This is a 2-step process which involves
    # checking whether code coverage is any better first and then check if all
    # changes are covered (stricter) which can only be done if the source code
    # is available (and enabled via the --source option).

    if not differ.has_better_coverage():
        return ExitCodes.COVERAGE_WORSENED

    if source:
        if differ.has_all_changes_covered():
            return ExitCodes.OK
        else:
            return ExitCodes.NOT_ALL_CHANGES_COVERED
    else:
        return ExitCodes.OK
github aconrad / pycobertura / pycobertura / cli.py View on Github external
def get_exit_code(differ, source):
    # Compute the non-zero exit code. This is a 2-step process which involves
    # checking whether code coverage is any better first and then check if all
    # changes are covered (stricter) which can only be done if the source code
    # is available (and enabled via the --source option).

    if not differ.has_better_coverage():
        return ExitCodes.COVERAGE_WORSENED

    if source:
        if differ.has_all_changes_covered():
            return ExitCodes.OK
        else:
            return ExitCodes.NOT_ALL_CHANGES_COVERED
    else:
        return ExitCodes.OK