How to use the pycobertura.cobertura.Cobertura 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_cobertura_diff.py View on Github external
def test_diff__has_not_better_coverage():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_better_coverage() is False
github aconrad / pycobertura / tests / test_cobertura_diff.py View on Github external
def test_diff__has_better_coverage():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_better_coverage() is True
github aconrad / pycobertura / tests / test_cobertura_diff.py View on Github external
def test_diff__has_better_coverage():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_better_coverage() is True
github aconrad / pycobertura / tests / test_cobertura_diff.py View on Github external
def test_diff__has_not_better_coverage():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_better_coverage() is False
github aconrad / pycobertura / tests / test_cobertura_diff.py View on Github external
def test_diff__has_all_changes_covered__some_changed_code_is_still_uncovered():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_all_changes_covered() is False
github aconrad / pycobertura / tests / test_cobertura_diff.py View on Github external
def test_diff__has_all_changes_covered__some_changed_code_is_still_uncovered():
    from pycobertura.cobertura import Cobertura, CoberturaDiff

    cobertura1 = Cobertura('tests/dummy.zeroexit1/coverage.xml')
    cobertura2 = Cobertura('tests/dummy.zeroexit2/coverage.xml')
    differ = CoberturaDiff(cobertura1, cobertura2)
    assert differ.has_all_changes_covered() is False
github aconrad / pycobertura / pycobertura / cli.py View on Github external
def show(cobertura_file, format, output, source, source_prefix):
    """show coverage summary of a Cobertura report"""
    fs = filesystem_factory(cobertura_file, source=source)
    cobertura = Cobertura(cobertura_file, filesystem=fs)
    Reporter = reporters[format]
    reporter = Reporter(cobertura)
    report = reporter.generate()

    if not isinstance(report, bytes):
        report = report.encode("utf-8")

    isatty = True if output is None else output.isatty()
    click.echo(report, file=output, nl=isatty)
github aconrad / pycobertura / pycobertura / cli.py View on Github external
format,
    output,
    source1,
    source2,
    source_prefix1,
    source_prefix2,
    source,
):
    """compare coverage of two Cobertura reports"""
    fs1 = filesystem_factory(
        report=cobertura_file1, source=source1, source_prefix=source_prefix1
    )
    fs2 = filesystem_factory(
        report=cobertura_file2, source=source2, source_prefix=source_prefix2
    )
    cobertura1 = Cobertura(cobertura_file1, filesystem=fs1)
    cobertura2 = Cobertura(cobertura_file2, filesystem=fs2)

    Reporter = delta_reporters[format]
    reporter_args = [cobertura1, cobertura2]
    reporter_kwargs = {"show_source": source}

    isatty = True if output is None else output.isatty()

    if format == "text":
        color = isatty if color is None else color is True
        reporter_kwargs["color"] = color

    reporter = Reporter(*reporter_args, **reporter_kwargs)
    report = reporter.generate()

    if not isinstance(report, bytes):
github aconrad / pycobertura / pycobertura / cli.py View on Github external
output,
    source1,
    source2,
    source_prefix1,
    source_prefix2,
    source,
):
    """compare coverage of two Cobertura reports"""
    fs1 = filesystem_factory(
        report=cobertura_file1, source=source1, source_prefix=source_prefix1
    )
    fs2 = filesystem_factory(
        report=cobertura_file2, source=source2, source_prefix=source_prefix2
    )
    cobertura1 = Cobertura(cobertura_file1, filesystem=fs1)
    cobertura2 = Cobertura(cobertura_file2, filesystem=fs2)

    Reporter = delta_reporters[format]
    reporter_args = [cobertura1, cobertura2]
    reporter_kwargs = {"show_source": source}

    isatty = True if output is None else output.isatty()

    if format == "text":
        color = isatty if color is None else color is True
        reporter_kwargs["color"] = color

    reporter = Reporter(*reporter_args, **reporter_kwargs)
    report = reporter.generate()

    if not isinstance(report, bytes):
        report = report.encode("utf-8")