Skip to content

Paper cut: Better handling of "CoverageException: Can't add arcs to existing line data" ? #803

Closed
@PiDelport

Description

@PiDelport

Is your feature request related to a problem? Please describe.

Previous closed issue, with comments: #476

Reproduction: In the process of adding coverage to an existing project's test suite, I first ran it without branch coverage, and then again after enabling branch coverage in .coveragerc, resulting in "CoverageException: Can't add arcs to existing line data".

I'm familiar enough with coverage to have guessed that it's a data file format problem, and deleted the .coverage file to fix it, but this won't be obvious to new or inexperienced users, and it probably represents a significant usability hurdle / paper cut bug (especially since it's most likely to occur when first adding coverage to a project in this way)

Describe the solution you'd like

One or more of:

  1. A more descriptive and actionable error message: at least, something that would lead new / inexperienced users to clearing the coverage database, for example.
  2. More generally, a mechanism to recognise when the coverage database format is not compatible with a coverage run's invocation options, so that this kind of case can be handled better in general?

Additional context

This is the relevant traceback (with coverage 4.5.3, invoked via nosetests --with-coverage):

Traceback (most recent call last):
  […]
  File "…/site-packages/coverage/control.py", line 807, in combine
    self.get_data()
  File "…/site-packages/coverage/control.py", line 833, in get_data
    if self.collector.save_data(self.data):
  File "…/site-packages/coverage/collector.py", line 404, in save_data
    covdata.add_arcs(abs_file_dict(self.data))
  File "…/site-packages/coverage/data.py", line 365, in add_arcs
    raise CoverageException("Can't add arcs to existing line data")
coverage.misc.CoverageException: Can't add arcs to existing line data

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions