Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
PiDelport opened this issue May 16, 2019 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@PiDelport
Copy link

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
@PiDelport PiDelport added the enhancement New feature or request label May 16, 2019
@nedbat
Copy link
Owner

nedbat commented May 17, 2019

I think you are right, this is definitely a place where the messaging could be made more relevant to the user's perspective rather than the code's perspective, so that the user understands what's happening.

@nedbat nedbat added this to the 5.1 milestone Jan 15, 2020
@nedbat nedbat closed this as completed in 1699725 Feb 28, 2021
@nedbat
Copy link
Owner

nedbat commented Feb 28, 2021

This is now released as part of coverage 5.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants