-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix inconsistency between traced files and reported files #2784
Conversation
Thanks. Do you think you could come up with a test case for this? This seems like the kind of setup that will get lost and break right the next time we change the code. |
@scoder A test case is added. It mocks the behavior of |
from Cython.Build import cythonize | ||
|
||
setup(ext_modules = cythonize([ | ||
'pkg/*.py*', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually necessary for this test to compile the .py
files, in addition to the .pyx
files?
I'm asking for two reasons: it complicates the test setup (thus increasing the risk of potentially unrelated failures), and there is currently a bug in your branch that I fixed in latest master regarding the compilation of __init__.py
files under Windows, so I'm getting failures in appveyor. Merging master should resolve that, but if we can avoid this complication entirely, then that's clearly preferable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, changed to *.pyx
.
Thanks |
When solving #2776 which reported
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 executingcoverage report
, I find the cause is that some tracers built in Cython.Coverage do not have corresponding reporters.In Cython.Coverage, when
Plugin._parse_lines(c_file, filename)
returns (None, None),Plugin.file_tracer(filename)
returns a tracer, whilePlugin.file_reporter(filename)
returns None, and then coverage.py reports the error. This happens when shared packages have both *.py and *.c sharing the same base name. For instance, in the wheel package of gevent, both _hub_local.c and _hub_local.py exist, which mislead Cython.Coverage to produce a tracer as it does not ignore shared libraries. However, file_reporter() ignores shared libraries, and the report error is raised.The simple solution is to ignore shared libraries in file_tracer like it does in file_reporter, and
coverage report
does not raise errors, thus fixes #2776 .