Skip to content

Commit ed2482b

Browse files
committed
coverage combine does not delete .coverage file if present
Previously coverage combine was not appending data to a `.coverage` file, if that was present, but was instead deleting it. Now we call `coverage combine -a` if we find `.coverage*` files. This appends data to an existing `.coverage` file, or otherwise creates a new one.
1 parent c30509b commit ed2482b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

codecov/__init__.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -657,11 +657,14 @@ def main(*argv, **kwargs):
657657
# Call `coverage xml` when .coverage exists
658658
# -----------------------------------------
659659
# Ran from current directory
660-
if os.path.exists(opj(os.getcwd(), '.coverage')) and not os.path.exists(opj(os.getcwd(), 'coverage.xml')):
661-
if glob.glob(opj(os.getcwd(), '.coverage.*')):
662-
write(' Mergeing coverage reports')
663-
try_to_run('coverage combine')
660+
if glob.glob(opj(os.getcwd(), '.coverage.*')):
661+
write(' Mergeing coverage reports')
662+
# The `-a` option is mandatory here. If we
663+
# have a `.coverage` in the current directory, calling
664+
# without the option would delete the previous data
665+
try_to_run('coverage combine -a')
664666

667+
if os.path.exists(opj(os.getcwd(), '.coverage')) and not os.path.exists(opj(os.getcwd(), 'coverage.xml')):
665668
write(' Generating coverage xml reports for Python')
666669
# using `-i` to ignore "No source for code" error
667670
try_to_run('coverage xml -i')

0 commit comments

Comments
 (0)