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

cannot parse Cython when creating xml #601

Closed
nedbat opened this issue Sep 10, 2017 · 2 comments
Closed

cannot parse Cython when creating xml #601

nedbat opened this issue Sep 10, 2017 · 2 comments
Labels
bug Something isn't working xml

Comments

@nedbat
Copy link
Owner

nedbat commented Sep 10, 2017

Originally reported by Ioannis Filippidis (Bitbucket: johnyf, GitHub: johnyf)


coverage.py cannot parse Cython code. Running coverage xml -i produces the warning Coverage.py warning: Could not parse Python file /path/dd/dd/cudd.pyx, which is a warning discussed in #396.

Without the -i option the output is Couldn't parse '/path/github/dd/dd/cudd.pyx' as Python source: 'invalid syntax' at line 27, where line 27 reads from libcpp cimport bool. (I am aware of Cython's annotating capability for coverage results, but that too takes xml as input.)

Does coverage.py support Cython? If not, are there any future plans in that direction?

Relevant also to: cython/cython#1508


@nedbat
Copy link
Owner Author

nedbat commented Sep 10, 2017

Original comment by Ioannis Filippidis (Bitbucket: johnyf, GitHub: johnyf)


It turns out that even though my .coveragerc included the Cython plugin, it was under the tests/ directory (where I run tests on the installed package), but I was attempting to collect coverage measurements while outside the tests directory (because building in-place is required). Copying .coveragerc to the directory where I run nosetests resolved the issue.

It would be great to see #597 being resolved. For the time being I cannot get [paths] to work properly when running nosetests within the tests/ directory, unless I manually edit the paths within the generated .coverage and copy the resulting .coverage file to outside the tests/ directory (even when all the paths are absolute).

It is interesting that running from within tests/ with the package installed as normal does collect statistics for pyx files, but does not insert "file_tracers":{"/path/dd/dd/cudd.pyx" in the .coverage file. Adding this to the file, replacing the paths with the correct absolute paths, then moving the resulting .coverage to the parent directory (from where the built-in-place dd/*.so are visible), and running coverage xml works.

@nedbat nedbat closed this as completed Sep 10, 2017
@nedbat nedbat added minor bug Something isn't working xml labels Jun 23, 2018
@webknjaz
Copy link
Contributor

Ref: cython/cython#3636

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

No branches or pull requests

2 participants