question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Differences in coverage percentage between Python 3.7 and Python 3.8

See original GitHub issue

Describe the bug The coverage percentage appears to be sensible to the Python version under which coverage run and coverage combine + coverage report are executed. Specifically, the coverage percentage varies depending on the combinations of Python versions those commands are run with (while using the same version of coverage.py).

I have experienced the following patterns:

coverage run coverage combine + coverage report coverage percentage
Python 3.7 Python 3.7 100%
Python 3.8 Python 3.8 100%
Python 3.7 Python 3.8 92%
Python 3.8 Python 3.7 100%

To Reproduce

  • Clone this repository: https://github.com/sanjioh/tox-interpreters.
  • Run tox -r -e py38-tox314,coverage-report. This should report a 100% coverage.
  • Run tox -r -e py37-tox314,coverage-report. This should report a 92% coverage.
  • If basepython for the coverage-report tox env is changed to python3.7, coverage consistently reports 100%, as per the above table.

coverage.py version: 4.5.4

Expected behavior I would expect to get 100% coverage for the combination of coverage run run with Python 3.7, coverage combine + coverage report run with Python 3.8.

Thanks for your support, please let me know if you need any further information.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
nedbatcommented, Dec 8, 2019

I’ve updated the FAQ in 8ed8cbec7581d942a8aaafd1341fe20fb33aef96

1reaction
ArturKlausercommented, Dec 4, 2019

Just FYI (I ran into the same issue): I think this problem is bound to become more prevalent now that python 3.8 is starting to become the ‘default’ python version in places, e.g. CI environments. E.g. I was running coverage over a test matrix of python versions and then combining+reporting with the default (i.e. newest stable) python version, which brings out this decorator problem. Maybe add to FAQ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

FAQ and other help — Coverage.py 6.5.0 documentation
Different versions of Python report execution on different lines. Coverage.py adapts its behavior to the version of Python being used. In Python 3.7...
Read more >
What's New In Python 3.8 — Python 3.11.1 documentation
This article explains the new features in Python 3.8, compared to 3.7. Python 3.8 was released on October 14, 2019. For full details,...
Read more >
Is python 3.7 and 3.9 the same? Pls help - Quora
They are similar enough that all code written for 3.7 will run under 3.9 (so long as you have any updated versions of...
Read more >
pytest-cov in tox reports different coverage percentage from ...
pytest-cov in tox reports different coverage percentage from two different ... Python :: 3.7", "Programming Language :: Python :: 3.8", ...
Read more >
coverage - PyPI
Code coverage measurement for Python. ... It uses the code analysis tools and tracing hooks provided in the Python standard ... CPython 3.7...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found