-
Notifications
You must be signed in to change notification settings - Fork 20
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 --gcov-report
flag to spin test
#159
Add --gcov-report
flag to spin test
#159
Conversation
.github/workflows/test.sh
Outdated
echo "Yes" | ||
fi | ||
|
||
# TODO: Test other coverage reports |
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.
TODO: I'll cover this as a part of #154 to avoid bloat here
4299ecd
to
3b5fdfc
Compare
Thanks, Ganesh, I've done a brief pass and all looks good. There are a few small tweaks I'd like to make, which I'll do Monday morning. Instead of generate-gcov-report, perhaps the shorter gcov-report? Happy to make that tweak myself, just wanted to make sure you don't object. |
--generate-gcov-report
flag to spin test
--gcov-report
flag to spin test
--gcov-report
flag to spin test
--gcov-report
flag to spin test
Thanks for the review @stefanv , I have renamed the flag to |
if f"coverage-{coverage_type.value}" not in p.stdout.decode("ascii"): | ||
raise click.ClickException( | ||
f"coverage-{coverage_type.value} is not supported... " | ||
f"Ensure the following are installed: {', '.join(requirements[coverage_type])} " |
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.
This error is raised when spin build; spin test --gcov-report
. Needs to ensure that build was run with --gcov
.
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.
Yep, shall I add a dependency to call spin build --gcov
in case it's missing?
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.
Ah ok, I get the problem. We need to check for coverage artifacts. Let me add it.
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.
Added checks and UT in f2c21eb
After looking at this some more, I'm wondering if the Also, doing So, I'd suggest moving |
I'll note that this isn't specific to
I'm not sure I understand that suggestion, or maybe I'm missing your point. You typically build from scratch once, and run tests many times when you're developing. You don't want a coverage report every time you run tests, so it shouldn't be done automatically. But conceptually, you want the coverage report for the tests you've just run I think, through a "give me the gcov coverage report". So it could be integrated with |
That was my original understanding, but then I couldn't see where the gcov outputs are generated by pytest. I clearly missed it, so I'll take another look. |
It's a separate command, unrelated to |
0d18f0c
to
b57bc87
Compare
81ea2da
to
9749de0
Compare
@@ -3,5 +3,5 @@ | |||
|
|||
@nox.session | |||
def test(session: nox.Session) -> None: | |||
session.install(".", "pytest", "build", "meson-python", "ninja") | |||
session.install(".", "pytest", "build", "meson-python", "ninja", "gcovr") |
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.
@stefanv / @jarrodmillman , should this be part of a test_requirements.yaml
for depandabot to pick up and auto update or this is ok?
Co-authored-by: Jarrod Millman <[email protected]>
f2c21eb
to
389193d
Compare
@ganesh-k13 Sorry for the delay working on this. I've reworked the logic a bit, as detailed in the commit message of 135279f. Take a look, and see if you approve of what I've done? |
- Like the existing coverage option, `spin test --gcov` is now enough to generate gcov reports. - The format of the report is set with `--gcov-format`. - Coverage builds are triggered when `--gcov` is added (necessary to generate the coverage report), but no rebuild is done when the flag is removed (too expensive).
389193d
to
135279f
Compare
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.
Thanks, looks good! I cannot approve as I'm the author, but looks good to go. I'll port this to NumPy and hopefully enable code cov reports in the CI soon.
Changes
--gcov-report
flag tospin test
Testing
Happy Path
Failures
Notes
ToDo
Misc
resolves #158
continues #146