Closed diefans closed 10 years ago
Can you please test against latest master, there are various improvements/fixes not yet released.
Sorry, I get the same results...
I was experiencing a similar issue where running:
$ py.test --cov mymodule --cov-report=term-missing
was reporting correct coverage. Then when running through setuptools like:
$ python setup.py test
The coverage was incorrect. However, installing the latest from master
branch has fixed my issue.
@diefans Confirmed: https://travis-ci.org/schlamar/pytest-cov/builds/26548730
@mattupstate That seems unrelated, but thanks for confirming that master solves a few issues.
This is an upstream issue: https://bitbucket.org/hpk42/py/issue/45/forkedfunc-skips-exit-handlers-breaks
@diefans I have a hacky but working solution by patching py.process.ForkedFunc. Not sure if I want to roll that out officially. But it should work if you add this to your conftest.py: https://github.com/schlamar/pytest-cov/commit/fb100dba36079227a3f491d3d055f9e377031c59
I have prepared a much nicer solution upstream:
@schlamar Since this is upstream bug, does this mean you can release without the monkeypatching? Or are you going to wait for upstream anyways?
@sontek I'm going to wait for the decision on my pull request for py. If it is merged I can release because pytest-cov doesn't need any further changes.
@sontek 1.7.0 just released
@diefans this will be fixed as soon as a new py version is released, my pull request was merged
@diefans should be fixed, you just need to upgrade py to 1.4.21 and cov-core to 1.13.0.
Broken again with py 1.4.22 https://bitbucket.org/hpk42/py/diff/py/_process/forkedfunc.py?diff2=37f557844498&at=default
Yes, I know. We are working something out. For now, you can pin py to 1.4.21.
pytest 2.6.0 depends on py 1.4.22, so you require to downgrade them both =)
My 2 years old patch is still working:
But I if you want things to make right you probably should ask xdist to provide box_start/box_stop hooks which you will be able to use.
@mocksoul Do you have some code? =)
Do we have a fix for this?
@aconrad #15 should fix it, I might find some time at the weekend to have a look at it.
fixed (again) in 1633bd354f17ed9906a110d9f7ced69921b70f47, will be released soon
Sweet! @schlamar can you ping this ticket when a new release is available? Thanks!
As being said, it is fixed in pytest-cov-1.8.0, https://pypi.python.org/pypi/pytest-cov/1.8.0
I need to run my tests with xdist's --boxed feature. there is a big difference in coverage compared to running unboxed:
35 % of all modules are completely uncovered. I also noticed, that despite that I run the tests with
py.test tests/ --boxed -d -n 8 --random
the uncovered modules are always the same.When I run one single test module in boxed mode coverage complains that the module to cover was not imported: