Skip to content

Commit 562e759

Browse files
committed
fix: make a combine error message clearer
1 parent d191d10 commit 562e759

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

CHANGES.rst

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ upgrading your version of coverage.py.
2323
Unreleased
2424
----------
2525

26-
Nothing yet.
26+
- If you attempt to combine statement coverage data with branch coverage data,
27+
coverage.py used to fail with the message "Can't combine arc data with line
28+
data" or its reverse, "Can't combine line data with arc data." These
29+
messages used internal terminology, making it hard for people to understand
30+
the problem. They are now changed to mention "branch coverage data" and
31+
"statement coverage data."
2732

2833

2934
.. scriv-start-here

coverage/sqldata.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,9 @@ def update(
663663
getattr(other_data, "_filename", "???"),
664664
))
665665
if self._has_lines and other_data._has_arcs:
666-
raise DataError("Can't combine arc data with line data")
666+
raise DataError("Can't combine branch coverage data with statement data")
667667
if self._has_arcs and other_data._has_lines:
668-
raise DataError("Can't combine line data with arc data")
668+
raise DataError("Can't combine statement coverage data with branch data")
669669

670670
map_path = map_path or (lambda p: p)
671671

tests/test_data.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,12 @@ def test_update_cant_mix_lines_and_arcs(self) -> None:
405405
covdata2 = DebugCoverageData(suffix='2')
406406
covdata2.add_arcs(ARCS_3)
407407

408-
with pytest.raises(DataError, match="Can't combine arc data with line data"):
408+
msg = "Can't combine branch coverage data with statement data"
409+
with pytest.raises(DataError, match=msg):
409410
covdata1.update(covdata2)
410411

411-
with pytest.raises(DataError, match="Can't combine line data with arc data"):
412+
msg = "Can't combine statement coverage data with branch data"
413+
with pytest.raises(DataError, match=msg):
412414
covdata2.update(covdata1)
413415

414416
def test_update_file_tracers(self) -> None:

0 commit comments

Comments
 (0)