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

Cython.Coverage produces error when using gevent #2776

Closed
wjsi opened this issue Jan 2, 2019 · 5 comments · Fixed by #2784
Closed

Cython.Coverage produces error when using gevent #2776

wjsi opened this issue Jan 2, 2019 · 5 comments · Fixed by #2784

Comments

@wjsi
Copy link
Contributor

wjsi commented Jan 2, 2019

Hi,

I build a simple pyx with gevent module (https://github.com/wjsi/test_cython_cov/blob/master/test_cov.pyx) and try to use Cython.Coverage to get code coverage, it produces an error when coverage report is executed:

$ coverage run test_file.py
$ coverage report
Plugin 'Cython.Coverage.Plugin' did not provide a file reporter for '/Users/wenjun.swj/miniconda3/lib/python3.7/site-packages/gevent/_hub_local.py'.

When gevent is removed, for instance, replaced with time module, no errors raised and the report is shown normally.

I uploaded all test files in https://github.com/wjsi/test_cython_cov. I'm running on MacOS 10.14 with Anaconda Python 3.7.1, cython==0.29.2 and coverage==4.5.2.

@scoder
Copy link
Contributor

scoder commented Jan 11, 2019

Thanks for the report. I have no idea what gevent does here, so this needs more investigation to find out how this differs from normal CPython behaviour and what can be done to make this work.

@wjsi
Copy link
Contributor Author

wjsi commented Jan 11, 2019

@scoder during compilation, gevent compiles its _hub_local.py in https://github.com/gevent/gevent/blob/master/setup.py#L117 using cython into __hub_local.so and then import the compiled lib on the bottom of https://github.com/gevent/gevent/blob/master/src/gevent/_hub_local.py#L101 to get itself accelerated, which produces a _hub_local.c with path gevent/src/gevent/_hub_local.c. However, when installed as a wheel package, the path becomes gevent/_hub_local.c, therefore Cython.Coverage cannot spot the path of _hub_local.py. When creating the tracer, it reports no errors. However, when creating the reporter, no source file can be spotted and the error occurs.
I've written a test case to reproduce this error in #2784.

@user36362992
Copy link

I'm also having this issue:

WARNING: Failed to generate report: Plugin 'Cython.Coverage.Plugin' did not provide a file reporter for u'/opt/opsview/python/lib/python2.7/site-packages/gevent/greenlet.py'.

Any news on when/how it might be resolved?

@scoder
Copy link
Contributor

scoder commented Aug 14, 2019

I think this qualifies for a backport.

@scoder scoder modified the milestones: 3.0, 0.29.14, 0.29.3 Aug 14, 2019
@scoder
Copy link
Contributor

scoder commented Aug 14, 2019

Actually, the fix was included in 0.29.3, so this is resolved already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants