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

Combine coverage files without deleting combined files #1108

Closed
elarivie opened this issue Jan 27, 2021 · 4 comments
Closed

Combine coverage files without deleting combined files #1108

elarivie opened this issue Jan 27, 2021 · 4 comments
Labels
enhancement New feature or request fixed

Comments

@elarivie
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When using the combine feature, a combined coverage file is created and💥 the original files are deleted

Describe the solution you'd like
I would like the original files to be kept untouched (do not delete them)

Or have a command line argument to tell combine to keep the original coverage files

Describe alternatives you've considered

  • alternative # 1 is to create backup copy of the original coverage files somewhere else (temp folder) combine them there and bring back the combined file.

  • Alternative # 2 is to create a backup copy somewhere else of the original coverage files, combine, copy the originals back after

  • Alternative # 3 Run all test twice to avoid the need to combine coverage files

  • Alternative # 4 wait till the coverage files are no more needed before doing combine

Note: I don't like any of the above alternatives hack

Additional context
Here is my use case:

1- I run different kind of test (unit tests, integration tests, smoke tests, ...)
2- I then obtain a coverage file for each of them (unittest.coverage, integrationtest.coverage, smoketest.coverage)
3- I combine them into a alltest.coverage
4- I successfully obtain the alltest.coverage but 💥Oups!; the original unittest.coverage, integrationtest.coverage, smoketest.coverage, etc are gone (they have been deleted by the combine)
5- 💥 I want to use the coverage files of each test types for further processing but their coverage files are gone.

@elarivie elarivie added the enhancement New feature or request label Jan 27, 2021
@nedbat
Copy link
Owner

nedbat commented Jan 27, 2021

This seems like a simple enough option to add. But I am curious: why not generate the individual reports first from the separate data files, and then combine them to produce the combined report?

@elarivie
Copy link
Contributor Author

I didn't write it in my original post but the reason is because I am using GNUmake to coordinates the build steps.

So from a GNUmake point of view once the coverages files exists it triggers the next targets which depend on them:

  1. The target which combine them
  2. and also in parallel the targets which generates reports

Step 2 fail because of step 1

elarivie added a commit to elarivie/coveragepy that referenced this issue Jan 30, 2021
elarivie added a commit to elarivie/coveragepy that referenced this issue Jan 30, 2021
nedbat pushed a commit that referenced this issue Jan 30, 2021
* Add combine --keep

Related to #1108

* Fix unit tests

* Fix line too long

* Fix line too long
@nedbat
Copy link
Owner

nedbat commented Jan 30, 2021

This has been implemented in #1110

@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 fixed
Projects
None yet
Development

No branches or pull requests

2 participants