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

Add Cython coverage plugin #188

Merged
merged 7 commits into from
Aug 15, 2024

Conversation

oscarbenjamin
Copy link
Collaborator

This only works with a small patch to Cython.

You can install the patched Cython from my fork with:

pip install git+https://github.com/oscarbenjamin/cython.git@pr_relative_paths

(I am about to open a Cython PR from that branch.)

Then to make a coverage enabled build you need:

meson setup build -Dcoverage=true

Then to run the tests and measure coverage it is:

spin run -- coverage run -m flint.test
coverage report
coverage html

Ideally once Cython is patched we can somehow put this altogether as a spin coverage command to make it nice and easy.

I basically had to rewrite Cython's coverage plugin, largely from scratch. I think that the only part left from the original after I rewrote everything is the parse_cfile_lines function.

For now we can merge this to python-flint but ideally this would be upstreamed to either spin or Cython I think so I will follow up with that after.

@oscarbenjamin
Copy link
Collaborator Author

Then to make a coverage enabled build you need:

meson setup build -Dcoverage=true

Then to run the tests and measure coverage it is:

spin run -- coverage run -m flint.test
coverage report
coverage html

I've updated bin/coverage.sh to do all of these things.

@oscarbenjamin oscarbenjamin merged commit 23e1ed3 into flintlib:master Aug 15, 2024
32 checks passed
@oscarbenjamin oscarbenjamin deleted the pr_coverage_plugin branch August 15, 2024 21:15
@oscarbenjamin
Copy link
Collaborator Author

@GiacomoPope @Jake-Moss

This should make it possible to do coverage measurement with the meson build. For now my patched Cython is needed:

pip uninstall cython
pip install git+https://github.com/oscarbenjamin/cython.git@pr_relative_paths

Then

bin/coverage.sh

should give you the coverage report.

Let me know if it doesn't work.

@GiacomoPope
Copy link
Contributor

Oh cool! I'll have a play tomorrow, although now I've added the two types on my TODO list I probably have other implementation things to help people with!

@Jake-Moss
Copy link
Contributor

Wonderful work thanks! It's working for me

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

Successfully merging this pull request may close these issues.

3 participants