Skip to content

Commit

Permalink
Don't turn on branch coverage by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
asherf committed Jul 16, 2020
1 parent 063401e commit b576612
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
1 change: 0 additions & 1 deletion src/python/pants/backend/python/rules/coverage.py
Expand Up @@ -151,7 +151,6 @@ def _validate_and_update_config(
) -> None:
if not coverage_config.has_section("run"):
coverage_config.add_section("run")
coverage_config.set("run", "branch", "True")
run_section = coverage_config["run"]
relative_files_str = run_section.get("relative_files", "True")
if relative_files_str.lower() != "true":
Expand Down
39 changes: 20 additions & 19 deletions src/python/pants/backend/python/rules/coverage_integration_test.py
Expand Up @@ -145,18 +145,18 @@ def test_coverage(self) -> None:
assert (
dedent(
f"""\
Name Stmts Miss Branch BrPart Cover
-----------------------------------------------------------------------------------------------
{tmpdir_relative}/src/python/project/__init__.py 0 0 0 0 100%
{tmpdir_relative}/src/python/project/lib.py 6 0 0 0 100%
{tmpdir_relative}/src/python/project/lib_test.py 3 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/__init__.py 0 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/__init__.py 0 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/test_no_src.py 2 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/test_arithmetic.py 3 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/test_multiply.py 3 0 0 0 100%
-----------------------------------------------------------------------------------------------
TOTAL 17 0 0 0 100%
Name Stmts Miss Cover
---------------------------------------------------------------------------------
{tmpdir_relative}/src/python/project/__init__.py 0 0 100%
{tmpdir_relative}/src/python/project/lib.py 6 0 100%
{tmpdir_relative}/src/python/project/lib_test.py 3 0 100%
{tmpdir_relative}/tests/python/project_test/__init__.py 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/__init__.py 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/test_no_src.py 2 0 100%
{tmpdir_relative}/tests/python/project_test/test_arithmetic.py 3 0 100%
{tmpdir_relative}/tests/python/project_test/test_multiply.py 3 0 100%
---------------------------------------------------------------------------------
TOTAL 17 0 100%
"""
)
in result.stderr_data
Expand All @@ -169,16 +169,17 @@ def test_coverage_with_filter(self) -> None:
result = self._run_tests(
tmpdir_relative, "--coverage-py-filter=['project.lib', 'project_test.no_src']"
)
print(result.stderr_data)
assert (
dedent(
f"""\
Name Stmts Miss Branch BrPart Cover
-----------------------------------------------------------------------------------------------
{tmpdir_relative}/src/python/project/lib.py 6 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/__init__.py 0 0 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/test_no_src.py 2 0 0 0 100%
-----------------------------------------------------------------------------------------------
TOTAL 8 0 0 0 100%
Name Stmts Miss Cover
---------------------------------------------------------------------------------
{tmpdir_relative}/src/python/project/lib.py 6 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/__init__.py 0 0 100%
{tmpdir_relative}/tests/python/project_test/no_src/test_no_src.py 2 0 100%
---------------------------------------------------------------------------------
TOTAL 8 0 100%
"""
)
in result.stderr_data
Expand Down
2 changes: 0 additions & 2 deletions src/python/pants/backend/python/rules/coverage_test.py
Expand Up @@ -53,7 +53,6 @@ def test_default_no_config(self) -> None:
assert resolved_config == dedent(
"""\
[run]
branch = True
relative_files = True
omit =
\ttest_runner.pex/*
Expand Down Expand Up @@ -97,7 +96,6 @@ def test_config_no_run_section(self) -> None:
ignore_errors = True
[run]
branch = True
relative_files = True
omit =
\ttest_runner.pex/*
Expand Down

0 comments on commit b576612

Please sign in to comment.