Codecov coverage statistics don't match reported details on CI

Description

The code coverage statistics shown by codecov don’t match the statistics given by the Python coverage tool when used on the same test run.

Specifically, I am running python -m pytest -v --cov-report=xml --cov=Py6S test/ in my CI to calculate coverage. If I then run coverage report, also in the CI, I get

Name                                  Stmts   Miss  Cover
---------------------------------------------------------
Py6S/Params/__init__.py                  10      0   100%
Py6S/Params/aeroprofile.py               96      6    94%
Py6S/Params/altitudes.py                 31      2    94%
Py6S/Params/atmoscorr.py                 11      2    82%
Py6S/Params/atmosprofile.py              37      1    97%
Py6S/Params/geometry.py                  88     21    76%
Py6S/Params/ground_reflectance.py       108     38    65%
Py6S/Params/wavelength.py               337      5    99%
Py6S/SixSHelpers/__init__.py              7      0   100%
Py6S/SixSHelpers/aeronet.py              98      4    96%
Py6S/SixSHelpers/all_angles.py          111     68    39%
Py6S/SixSHelpers/all_wavelengths.py     250      8    97%
Py6S/SixSHelpers/radiosonde.py           83     14    83%
Py6S/SixSHelpers/spectra.py              38     23    39%
Py6S/__init__.py                         12      0   100%
Py6S/lut_trial.py                         0      0   100%
Py6S/outputs.py                         138     31    78%
Py6S/sixs.py                            159     58    64%
Py6S/sixs_exceptions.py                  18      4    78%
---------------------------------------------------------
TOTAL                                  1632    285    83%

That shows an overall coverage of 83%. However, when I view the report Codecov, I see a total coverage of only 38% (see Code coverage done right.).

If I view the raw coverage file from the Builds tab (eg. https://codecov.io/api/gh/robintw/Py6S/download/build?path=v4/raw/2020-10-13/0BF1585B91B60F3BE47B49AF3E767785/c95161b013bbb6c525fb16dab2277af0021cac6f/a4d28b37-5aaf-431e-bdfc-73b324e5c599.txt), then it looks like everything is ok. The paths all seem to be fine, and the first <coverage> element of the XML shows line-rate="0.8254", which matches what I expect.

Am I doing something wrong here? Am I not configuring Codecov properly? Does anyone have any idea what’s going on?

Repository

Repo on Codecov: Code coverage done right.

Github Actions log: https://github.com/robintw/Py6S/runs/1247239132?check_suite_focus=true

CI/CD

Github Actions

Uploader

codecov/codecov-action@v1 on Github Actions

Commit SHAs

c95161b013bbb6c525fb16dab2277af0021cac6f

Codecov YAML

No codecov.yml file - I don’t think I need one

Codecov Output

Run codecov/codecov-action@v1
bash codecov.sh -f ./coverage.xml -n  -F 

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-20201009-048fee3


==> GitHub Actions detected.
    project root: .
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage.xml bytes=62623
==> Appending adjustments
    https://docs.codecov.io/docs/fixing-reports
    -> No adjustments found
==> Gzipping contents
==> Uploading reports
    url: https://codecov.io
    query: branch=test-pr3&commit=93bf2c61c8a480af5cfaa35ad4202b5d814e0057&build=304238120&build_url=http%3A%2F%2Fgithub.com%2Frobintw%2FPy6S%2Factions%2Fruns%2F304238120&name=&tag=&slug=robintw%2FPy6S&service=github-actions&flags=&pr=71&job=&cmd_args=f,n,F
->  Pinging Codecov
https://codecov.io/upload/v4?package=bash-20201009-048fee3&token=secret&branch=test-pr3&commit=93bf2c61c8a480af5cfaa35ad4202b5d814e0057&build=304238120&build_url=http%3A%2F%2Fgithub.com%2Frobintw%2FPy6S%2Factions%2Fruns%2F304238120&name=&tag=&slug=robintw%2FPy6S&service=github-actions&flags=&pr=71&job=&cmd_args=f,n,F
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2020-10-13/0BF1585B91B60F3BE47B49AF3E767785/c95161b013bbb6c525fb16dab2277af0021cac6f/a4d28b37-5aaf-431e-bdfc-73b324e5c599.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOOG1EQX6OZVJGHKK3633AAFGLBUCOOATRACRQRQF6HMSMLYUP6EAD6XSWAAY%2F20201013%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20201013T111459Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=a98822fe8f200dcb42ce868923a856696e3599113b39f31912edc5e37ab4441c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  5377    0     0  100  5377      0  30902 --:--:-- --:--:-- --:--:-- 30902
    -> View reports at https://codecov.io/github/robintw/Py6S/commit/c95161b013bbb6c525fb16dab2277af0021cac6f

Hi @robintw, I believe you have a slew of builds, actually here. Codecov automatically merges all the different coverage reports together.