-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 on unit tests fails when tracking child processes #6887
Comments
For the records, this seems to be the first commit behaving in a strange way on codecov, but probably this is Travis fault (it was an automatic trigger of a commit that already went good before). The next commit that's passed on Travis is c3b003e, the build is here and the codecov report here. Both of the linux unit tests were not sent to codecov (so 8 reports instead of 10). It dates 2018-01-02T19:59:34Z. Commits before those two seem to end in a good way. Next step: what changed on 2018-01-02 ? |
Commit 088c193 scores 74.45% on codecov (last stable number). It has all 10 reports on
At this point I start to think that we had this bug with |
I think I finally got the the bottom of this twisted issue. Between 2.0.10 and 2.0.11 codecov/codecov-python#112 was merged. This means that we started calling: $ coverage combine twice. Now, doing this: $ coverage run --concurrency=multiprocessing bin/spack test
$ coverage combine
Coverage.py warning: Couldn't read data from '/home/mculpo/PycharmProjects/spack/.coverage.nuvolari.1043.077127': CoverageException: Doesn't seem to be a coverage.py data file will result very likely in some error. If you check your Running again: $ coverage combine (which is what effectively
|
Bottomline: yes, we have a buglet in our tests somewhere related to multiprocessing, |
I would seriously like to get to the bottom of these Travis network connection problems. I've never seen so many failing jobs before. But there's not much we can do on our end for that one. Good work! |
Reported in this issue the behavior of |
@alalazo Thanks for the report. I asked on the bitbucket issue for a reproducible case, but I see the issue there is anonymous. Or we can talk about it more here :) |
@nedbat Sure. Concerning a simple case to reproduce what I see with $ coverage run -p $(which flake8)
$ ls -a
. .. .coverage.nuvolari.4834.430541
$ touch .coverage.nuvolari.4677.764578
$ coverage combine
Coverage.py warning: Couldn't read data from '/home/mculpo/tmp/covbug/.coverage.nuvolari.4677.764578': CoverageException: Doesn't seem to be a coverage.py data file At this point $ coverage combine
Coverage.py warning: Couldn't read data from '/home/mculpo/tmp/covbug/.coverage.nuvolari.4677.764578': CoverageException: Doesn't seem to be a coverage.py data file the |
The problem here is two things working together:
If you use "coverage combine -a" instead, then it won't delete the data file during the combine step. |
@nedbat You're completely correct, and what you say was clear to me before - basically that's what I got tracking the issue we had. What I was wondering is if point 2. above:
is to be considered a bug or not for your application, as it may delete without warning a valid In our case it was not trivial to understand this, as some command down the chain (
What I was suggesting is that maybe
If you instead think |
According to what was discovered in spack#6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
According to what was discovered in spack#6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
According to what was discovered in spack#6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
According to what was discovered in spack#6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
* Revert "Travis: use --concurrency=multiprocessing only on build tests (#6872)" This reverts commit 596d463. * Removing 'coverage combine' in test script According to what was discovered in #6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
I think What about this: a key point in your scenario is that the second combine step doesn't find any usable data files. Perhaps we should avoid saving the new data file if there wasn't any actual combining that got done? |
Or perhaps: if after reading all the combinable files we could, there is no data at all, then don't write over the coverage data file? |
I just fixed this by raising an error if combine can't read any of the files it found. |
Thanks @nedbat. Just read your messages above. It seems to me a sensible behavior. |
* Revert "Travis: use --concurrency=multiprocessing only on build tests (spack#6872)" This reverts commit 596d463. * Removing 'coverage combine' in test script According to what was discovered in spack#6887, one of the problems is calling 'coverage combine' twice without the '-a' flag. This removes the first call within our test scripts.
This issue has been solved a year ago, forgot to close |
As of 596d463 using
concurrency=multiprocess
to run:$ coverage run bin/spack test
results in a few
.coverage*
files being corrupted. This may compromise the execution of:and in the end the coverage report from
codecov
(see data from January 2018, where it dropped from ~75% to ~50%).#6872 has been merged as a work-around to get more stable measurements, but the underlying issue with
pytest
+multiprocessing
+coverage
needs to be investigated further.@adamjstewart @tgamblin @scheibelp @becker33
The text was updated successfully, but these errors were encountered: