From 1e8eadf3272bc5473972cd4e50677a5789621ceb Mon Sep 17 00:00:00 2001 From: Pradeep Tammali Date: Sun, 2 Aug 2026 01:00:41 +0200 Subject: [PATCH] refactor: remove unused num_partial_branches field --- codecov/config.py | 1 - codecov/coverage/pytest.py | 4 ---- tests/conftest.py | 7 ------- tests/coverage/test_pytest.py | 2 -- 4 files changed, 14 deletions(-) diff --git a/codecov/config.py b/codecov/config.py index bc9772d..152240f 100644 --- a/codecov/config.py +++ b/codecov/config.py @@ -45,7 +45,6 @@ class Config: MINIMUM_GREEN: decimal.Decimal = decimal.Decimal('100') MINIMUM_ORANGE: decimal.Decimal = decimal.Decimal('70') TEST_FRAMEWORK: TestFramework = TestFramework.PYTEST - # TODO: Remove branch coverage and just use the report BRANCH_COVERAGE: bool = False MAX_FILES_IN_COMMENT: int = 25 SKIP_COVERED_FILES_IN_REPORT: bool = True diff --git a/codecov/coverage/pytest.py b/codecov/coverage/pytest.py index 96a5071..dc7b6e9 100644 --- a/codecov/coverage/pytest.py +++ b/codecov/coverage/pytest.py @@ -14,7 +14,6 @@ class PytestCoverageInfo: # pylint: disable=too-many-instance-attributes missing_lines: int excluded_lines: int num_branches: int | None - num_partial_branches: int | None # TODO: Removed this covered_branches: int | None missing_branches: int | None percent_covered: decimal.Decimal @@ -80,7 +79,6 @@ def extract_coverage_info(self, data: dict) -> PytestCoverageInfo: missing_lines=data['missing_lines'], excluded_lines=data['excluded_lines'], num_branches=data.get('num_branches'), - num_partial_branches=data.get('num_partial_branches'), covered_branches=data.get('covered_branches'), missing_branches=data.get('missing_branches'), ) @@ -116,7 +114,6 @@ def extract_info(self, data: dict) -> PytestCoverage: "missing_lines": 4, "excluded_lines": 0, "num_branches": 22, - "num_partial_branches": 4, "covered_branches": 18, "missing_branches": 4 }, @@ -134,7 +131,6 @@ def extract_info(self, data: dict) -> PytestCoverage: "missing_lines": 1, "excluded_lines": 0, "num_branches": 2, - "num_partial_branches": 1, "covered_branches": 1, "missing_branches": 1, }, diff --git a/tests/conftest.py b/tests/conftest.py index f8541e5..5f66a0f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -57,7 +57,6 @@ def _(code: str, has_branches: bool = True) -> PytestCoverage: missing_lines=0, excluded_lines=0, num_branches=0 if has_branches else None, - num_partial_branches=0 if has_branches else None, covered_branches=0 if has_branches else None, missing_branches=0 if has_branches else None, ), @@ -89,7 +88,6 @@ def _(code: str, has_branches: bool = True) -> PytestCoverage: missing_lines=0, excluded_lines=0, num_branches=0 if has_branches else None, - num_partial_branches=0 if has_branches else None, covered_branches=0 if has_branches else None, missing_branches=0 if has_branches else None, ), @@ -136,8 +134,6 @@ def _(code: str, has_branches: bool = True) -> PytestCoverage: coverage_obj.info.covered_branches += 1 file_coverage.info.missing_branches += 1 coverage_obj.info.missing_branches += 1 - file_coverage.info.num_partial_branches += 1 - coverage_obj.info.num_partial_branches += 1 elif 'branch covered' in line: file_coverage.executed_branches.append([line_number, line_number + 1]) file_coverage.info.num_branches += 1 @@ -234,8 +230,6 @@ def coverage_json(): 'missing_lines': 4, 'excluded_lines': 0, 'num_branches': 7, - # Line 5 is partial: one of its two arcs was taken. - 'num_partial_branches': 1, 'covered_branches': 4, 'missing_branches': 3, }, @@ -254,7 +248,6 @@ def coverage_json(): 'missing_lines': 4, 'excluded_lines': 0, 'num_branches': 7, - 'num_partial_branches': 1, 'covered_branches': 4, 'missing_branches': 3, }, diff --git a/tests/coverage/test_pytest.py b/tests/coverage/test_pytest.py index 45dbf8b..96bdfb0 100644 --- a/tests/coverage/test_pytest.py +++ b/tests/coverage/test_pytest.py @@ -38,7 +38,6 @@ def test_extract_info(self, coverage_json): missing_lines=4, excluded_lines=0, num_branches=7, - num_partial_branches=1, covered_branches=4, missing_branches=3, ), @@ -54,7 +53,6 @@ def test_extract_info(self, coverage_json): missing_lines=4, excluded_lines=0, num_branches=7, - num_partial_branches=1, covered_branches=4, missing_branches=3, ),