Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage combine when combining results from different interpreter versions results in missing coverage #1036

Closed
graingert opened this issue Oct 4, 2020 · 8 comments
Labels
bug Something isn't working combine works

Comments

@graingert
Copy link
Contributor

graingert commented Oct 4, 2020

Describe the bug
coverage combine when combining results from different interpreter versions results in missing coverage

To Reproduce
How can we reproduce the problem? Please be specific. Don't just link to a failing CI job. Answer the questions below:

  1. What version of Python are you using? 3.5, 3.6, 3.7, 3.8
  2. What version of coverage.py are you using? The output of coverage debug sys is helpful. 5.3
  3. What versions of what packages do you have installed? The output of pip freeze is helpful.
  4. What code are you running? Give us a specific commit of a specific repo that we can check out. https://codecov.io/gh/twisted/ldaptor/pull/207/changes
  5. What commands did you run? see https://github.com/twisted/ldaptor/pull/207/files#diff-522adf759addbd3b193c74ca85243f7dR73

Expected behavior
I expect to see line 40 of ldaptor/protocols/ldap/ldapconnector.py covered

Additional context
I'm currently trying out tox --parallel to save consumption of GHA parallel builds. Each build runs and then coverage combine runs at the end, as advised here https://tox.readthedocs.io/en/latest/example/basic.html#parallel-mode
see twisted/ldaptor#207

@graingert graingert added the bug Something isn't working label Oct 4, 2020
@nedbat
Copy link
Owner

nedbat commented Oct 11, 2020

I'm not sure what can be done about this. Different versions of Python produce slightly different data when tracing the same program, because of optimizations, or because of changed decisions about what the "right" trace is. If you measure on one version, then report using the same version, everything should make sense. But if you measure on one version, then report using a different version, you might get results that don't seem right.

The problem is only made more complicated when combining data from different runs.

But: you mentioned line 40 of ldapconnector.py should be covered. This is what I see:
image
Coverage.py knows that the "while True" is optimized away. This isn't an issue, since the line isn't marked as uncovered.

@graingert
Copy link
Contributor Author

@nedbat am I misinterpreting codecov here?

@nedbat
Copy link
Owner

nedbat commented Oct 11, 2020

There are three possible colors for a line: green (executed), red (could have executed but didn't), and while (couldn't have executed). Because the while True is optimized away, it is white. Only the red lines are problems, not the white ones.

@graingert
Copy link
Contributor Author

ah I see, so it's the correct result for 3.8+?

@nedbat
Copy link
Owner

nedbat commented Oct 11, 2020

Yes :)

@nedbat nedbat added the combine label Nov 15, 2021
@nedbat nedbat closed this as completed Nov 15, 2021
@graingert
Copy link
Contributor Author

@nedbat closed as working as designed?

@nedbat
Copy link
Owner

nedbat commented Nov 15, 2021

That was my interpretation of the discussion. Was I wrong?

@graingert
Copy link
Contributor Author

graingert commented Nov 15, 2021

That was my interpretation of the discussion. Was I wrong?

That was my interpretation, just double checking for myself and noting for posterity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working combine works
Projects
None yet
Development

No branches or pull requests

2 participants