# Coverage reports missing some covered code after processing

**URL:** <https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757>\
**Category:** Bug Fixes\
**Tags:** python\
**Created:** [July 16, 2020, 4:39am UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757 "2020-07-16T04:39:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimporter](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jimporter](https://community.codecov.com/u/jimporter)\
**Post date:** [July 16, 2020, 4:39am UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/1 "2020-07-16T04:39:51Z")

</div>

### Description

I have several coverage reports from a Python project generated on Travis CI and Appveyor; when uploaded and processed, the Appveyor reports are missing some code that was actually covered. It looks like the missing coverage is the code that’s run in a subprocess in the tests (it’s running the application and collecting coverage for it).

### Repository

> **[GitHub - jimporter/bfg9000: bfg9000 - build file generator](https://github.com/jimporter/bfg9000)**
>
> bfg9000 - build file generator

### CI/CD

Appveyor (plus Travis CI, but that appears to work fine).

Example job, with command-line output showing the coverage report for verification: [AppVeyor](https://ci.appveyor.com/project/jimporter/bfg9000/build/job/s4st0i2sq0iclndn)

### Uploader

Using codecov-python, invoked with `codecov --name "%APPVEYOR_JOB_NAME%"`

### Commit SHAs

> <https://github.com/jimporter/bfg9000/commit/b8e2f4523c37a591e8c15d8d8628761e292b8f3d>

### Codecov YAML

```auto
comment: false
coverage:
  status:
    project:
      default:
        informational: true
    patch:
      default:
        informational: true

```

### Codecov Output

```auto
      _____ _
     / ____ | | |
    | | _____ | | ______  _______
    | | / _ \ / _ |/ _ \/ __/ _ \ \ / /
    | |___| (_) | (_| |__/ (_| (_) \ V /
     \ _____\___ / \ ____|\___ |\ ___\___ / \_/
                                    v2.1.8
==> Detecting CI provider
    AppVeyor Detected
==> Preparing upload
==> Processing gcov (disable by -X gcov)
==> Collecting reports
XX> Searching for reports disabled
    Generating coverage xml reports for Python
    + C:\projects\bfg9000\coverage.xml bytes=368247
==> Uploading
    .url https://codecov.io
    .query commit=b8e2f4523c37a591e8c15d8d8628761e292b8f3d&branch=refactor-cc-msvc&job=jimporter%2Fbfg9000%2Frefactor-cc-msvc-2264&service=appveyor&build=s4st0i2sq0iclndn&slug=jimporter%2Fbfg9000&name=Image%3A%20Visual%20Studio%202013%3B%20Environment%3A%20COMPILER%3Dvs&yaml=codecov.yml&package=py2.1.8
    Gzipping contents..
    Compressed contents to 20136 bytes
    Pinging Codecov...
    Uploading to S3...
    https://codecov.io/github/jimporter/bfg9000/commit/b8e2f4523c37a591e8c15d8d8628761e292b8f3d

```

### Steps to Reproduce

1. Inject the following `sitecustomize.py` to collect coverage for Python subprocesses: `import coverage; coverage.process_startup()`
2. Run `coverage erase`
3. Run `coverage run setup.py test`
4. Run `coverage combine`
5. Submit coverage

**Expected behavior:** Full coverage; in particular, note the coverage for the file `bfg9000/tools/msvc/ __init__.py`. In the Appveyor log, it shows 99% coverage.

**Actual behavior:** In the Codecov report, `bfg9000/tools/msvc/ __init__.py` only shows 86% coverage: [https://codecov.io/gh/jimporter/bfg9000/src/b8e2f4523c37a591e8c15d8d8628761e292b8f3d/bfg9000/tools/msvc/\_\_init\_\_.py](https://codecov.io/gh/jimporter/bfg9000/src/b8e2f4523c37a591e8c15d8d8628761e292b8f3d/bfg9000/tools/msvc/ __init__.py). I’ve verified that the raw uploaded report looks ok.

**Flakiness?** This appears to happen all the time, since refactoring this part of the code to be in multiple files; formerly it lived in `bfg9000/tools/mscv.py` and worked fine.

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [July 16, 2020, 2:21pm UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/2 "2020-07-16T14:21:29Z")

</div>

Hi @jimporter, thanks for reaching out. So just a few questions, I looked in your repository, but I can’t seem to find where you are calling the `--name` argument on [codecov](https://github.com/jimporter/bfg9000/blob/69380cfeea6e1e3414c71dbed223e070472c09ba/appveyor.yml#L150). I’m asking because I see this line

> Searching for reports disabled

but that should only happen if it’s been [disabled](https://github.com/codecov/codecov-python/blob/master/codecov/ __init__.py#L988).

If you are more in the area of just getting this to work, I would recommend the [bash script](https://docs.codecov.io/docs/about-the-codecov-bash-uploader). You should be able to run something like

`bash <(curl -s https://codecov.io/bash) -U "-s" -A "-s"` (this is Windows specific)

---

<div class="post-metadata">

**Author:** ![jimporter](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jimporter](https://community.codecov.com/u/jimporter)\
**Post date:** [July 16, 2020, 8:45pm UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/3 "2020-07-16T20:45:39Z")

</div>

Here’s where I’m adding the `--name` argument; it’s on the `refactor-cc-msvc` branch: [https://github.com/jimporter/bfg9000/blob/refactor-cc-msvc/appveyor.yml#L151](https://github.com/jimporter/bfg9000/blob/refactor-cc-msvc/appveyor.yml#L151) (I added it because I was having a hard time figuring out which Appveyor job was which; their names were random strings of characters.)

However, on Appveyor, I’ve always seen `Searching for reports disabled`, and it’s worked fine. It correctly generates the XML version of my coverage (it says `Generating coverage xml reports for Python`). Searching through your link, it looks like this is an Appveyor-specific thing: [https://github.com/codecov/codecov-python/blob/066706eb2fab6c0fbe7c8f35d9b4bf405bf5db9f/codecov/\_\_init\_\_.py#L719-L720](https://github.com/codecov/codecov-python/blob/066706eb2fab6c0fbe7c8f35d9b4bf405bf5db9f/codecov/%5C_%5C_init%5C_%5C_.py#L719-L720)

For example, here’s a job from a previous commit on my master branch that says searching for reports is disabled, but I just called `codecov` with no options (after installing it via `pip install codecov`): [AppVeyor](https://ci.appveyor.com/project/jimporter/bfg9000/builds/34102725/job/pmyokxnf984qb4a0#L209).

Unfortunately, I wasn’t able to get the command `bash <(curl -s https://codecov.io/bash) -U "-s" -A "-s"` to work successfully on Appveyor (I tried cmd.exe, sh, and powershell syntaxes). I’ll keep poking at it to see if I can get some alternate spelling to work…

---

<div class="post-metadata">

**Author:** ![tom](https://yyz1.discourse-cdn.com/flex029/user_avatar/community.codecov.com/tom/32/8_2.png) [@tom](https://community.codecov.com/u/tom)\
**Post date:** [July 16, 2020, 8:55pm UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/4 "2020-07-16T20:55:05Z")

</div>

Hi @jimporter, I’ll take a deeper look at this, but I suggest

```auto
curl -s https://codecov.io/bash | bash -s -- -U "-s" -A "-s"

```

---

<div class="post-metadata">

**Author:** ![jimporter](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jimporter](https://community.codecov.com/u/jimporter)\
**Post date:** [July 16, 2020, 9:22pm UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/5 "2020-07-16T21:22:00Z")

</div>

Cool, that works, and the coverage appears to be reported as expected! I’ll switch to using the Bash uploader.

I plan to squash the commits and delete the `refactor-cc-msvc` branch that’s linked above, so some of the links above will 404. If it’s helpful, I’ll set up a branch that uses the codecov-python uploader so you have logs/commits to refer to for testing on your end (I’m not totally sure what info you’d need to fix the codecov-python uploader…)

---

<div class="post-metadata">

**Author:** ![jimporter](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@jimporter](https://community.codecov.com/u/jimporter)\
**Post date:** [July 17, 2020, 3:43am UTC](https://community.codecov.com/t/coverage-reports-missing-some-covered-code-after-processing/1757/6 "2020-07-17T03:43:12Z")

</div>

Ok, here’s a branch with the broken behavior for testing: [Test out codecov-python for Appveyor · jimporter/bfg9000@da2f21d · GitHub](https://github.com/jimporter/bfg9000/commit/da2f21d3ae2b52d010d13ac6d019cf457a718f4a). I’ll keep this branch around for a while so you can refer to it if needed.

On Appveyor, `coverage report` shows 99% coverage for `bfg9000/tools/msvc/ __init__.py`: [AppVeyor](https://ci.appveyor.com/project/jimporter/bfg9000/builds/34146951/job/8at2q5jjy8fbxw31#L438)

But on Codecov, this shows as 87%: [Codecov](https://codecov.io/gh/jimporter/bfg9000/src/da2f21d3ae2b52d010d13ac6d019cf457a718f4a/bfg9000/tools/msvc/_%5C_init__.py)
