Coverage.py 7.0.2 reports fewer statements than 7.0.1 under Python 3.7 · Issue #1524 · nedbat/coveragepy (original) (raw)

Describe the bug

Twine's scheduled CI failed this morning, because the coverage percentage dropped below the threshold under Python 3.7 (GHA), with 1785 statements executed. The day before, it passed (GHA), with 1807 statements executed. There were no commits in between. The only difference that I'm aware of is the release of Coverage.py 7.0.2, but I don't see any red flags in the release notes.

To Reproduce

  1. What version of Python are you using?
    3.7 and 3.8
  2. What version of coverage.py shows the problem? The output of coverage debug sys is helpful.
    7.0.2
  3. What versions of what packages do you have installed? The output of pip freeze is helpful.
    % .tox/py37/bin/pip freeze
 attrs==22.2.0  
 bleach==5.0.1  
 build==0.9.0  
 certifi==2022.12.7  
 charset-normalizer==2.1.1  
 commonmark==0.9.1  
 coverage==7.0.2  
 docutils==0.19  
 exceptiongroup==1.1.0  
 idna==3.4  
 importlib-metadata==6.0.0  
 importlib-resources==5.10.2  
 iniconfig==1.1.1  
 jaraco.classes==3.2.3  
 keyring==23.13.1  
 more-itertools==9.0.0  
 packaging==22.0  
 pep517==0.13.0  
 pkginfo==1.9.2  
 pluggy==1.0.0  
 pretend==1.0.9  
 Pygments==2.14.0  
 pytest==7.2.0  
 pytest-socket==0.5.1  
 readme-renderer==37.3  
 requests==2.28.1  
 requests-toolbelt==0.10.1  
 rfc3986==2.0.0  
 rich==13.0.0  
 six==1.16.0  
 tomli==2.0.1  
 twine @ file:///Users/bhrutledge/Dev/twine/.tox/.tmp/package/35/twine-4.0.3.dev21%2Bg89fba32.d20230103.tar.gz  
 typing_extensions==4.4.0  
 urllib3==1.26.13  
 webencodings==0.5.1  
 zipp==3.11.0  
  1. What code shows the problem?
    https://github.com/pypa/twine/tree/89fba32c3cf56ff6b02c691154b3de7faf7def04
  2. What commands did you run?
    I'm able to reproduce this locally by running tox -e py37 and changing the coverage requirement in deps (e.g. to coverage==7.0.1 and coverage<7).

Expected behavior

The number of executed statements should be the same as previous versions.

Additional context

There's no change in statements from Coverage.py 6.5.0 to 7.0.1; both report 1807.

Also maybe worth noting that py37 has always seemed to be lower; py38 and greater seem to consistently execute 1856 statements, with no change across Coverage.py versions.