-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
feat: coverage [APE-139] #1423
feat: coverage [APE-139] #1423
Conversation
Tested with https://github.com/ApeAcademy/Oracle Notes:
|
@fubuloubu sorry if i misled but this PR is far from working was moreso showing how to set it up and drive the hooks in. i appreciate you trying it out and i will ping again once it actually does something accurate |
i believe all these are resolved now |
Remaining TODOs for this PR:
Questions:
|
380e67b
to
6011d65
Compare
XML example (this gets automatically exported to .build) <?xml version="1.0" ?>
<coverage version="0.6.11" timestamp="1686262016035" lines-valid="13" lines-covered="7" line-rate="0.5385" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<!-- Generated by Ape Framework: https://docs.apeworx.io/ape/stable/index.html-->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/Users/jules/ApeProjects/ape-playground/contracts</source>
</sources>
<packages>
<package name="." line-rate="0.5385" branch-rate="0" complexity="0">
<classes>
<class name="Contract" line-rate="1.0" branch-rate="0" complexity="0">
<lines>
<line number="6" hits="2"/>
<line number="7" hits="4"/>
<line number="8" hits="3"/>
<line number="9" hits="3"/>
<line number="15" hits="1"/>
</lines>
</class>
<class name="IgnoreSomeOfMe" line-rate="0.0" branch-rate="0" complexity="0">
<lines>
<line number="4" hits="0"/>
<line number="5" hits="0"/>
<line number="6" hits="0"/>
</lines>
</class>
</classes>
</package>
</packages>
</coverage> Edited: we are now using the schema per spec code codecov |
Random question: would it be possible to combine these with reports in |
That would be a nice feature. codecov.io is a service that does this too. Since ive been mostly copying how Python does it, I think we could both have a merge function as well as codeov support. For sure the second one, I am going to make a TODO for that. |
Sweet! Doesn't have to be in this PR, but glad you agree it would be really awesome to support |
btw I really tried to use pytest-cov and coverage.py more but ran into a lot of issues. They are analyzing C stackframes and stuff and updating databases really fast, hard to really play with. They have a way to add tracers for non-python types , provided those files show in the python traceback. In Ape, we do inject revert lines in the python traceback that point to the contract, but not the entire trace.. that would be crazy... so I ended up ditching that plan and instead "being inspired by coverage.py and pytest-cov". |
we should make the HTML prettier tho, if i have time ill add a small CSS but we could add some branding and show off alex here eventually |
Co-authored-by: El De-dog-lo <3859395+fubuloubu@users.noreply.github.com>
For the html report, would it also be beneficial to have the verbose option to be built out on there or would that not really be necessary? |
Tested and worked great for me, left a minor comment previously |
ya i was thinking about this... I know Alex is helping improve the HTML, probably a good refactor / #GoodFirstIssue kind of situation when it comes to improving the HTML reporting in general; the sky is kind of the limit there. However, to address this comment, I went ahead and added some verbose HTML support so you can at least get verbose tables similar to the terminal output. Thank you all for reviewing! |
🍾 |
What I did
Bulk of the work was done already here: #1337
All this does is add the coverage feature.
It is not too hard to add arcs (branches) next, can do that, but wanted to let this simmer and let the dependent branches merge; it will be easier on me
Fixes: APE-139
fixes: #349
Tests are in
ape-vyper
: ApeWorX/ape-vyper#84Also need that PR in order for this to properly work.
How I did it
How to verify it
in your favorite project, find your favorite provider with tracing support and do this:
ape test --coverage --network ethereum:local:foundry
you should see something this:
mine is really bad
will update as it moves along
Checklist