-
Notifications
You must be signed in to change notification settings - Fork 784
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
Improving test coverage #2453
Comments
See also #2191 |
I finally got coverage working locally and I'm going to chip away at some of these. |
What do you folks think about coverage for |
Doesn't that coverage include whether an external function is called or not? While I am sympathetic to the idea that covering FFI definitions does not gain much (and this is definitely a sore spot for rust-numpy as well), I would say there is still value in having runtime tests for declared foreign API. Especially since that FFI is not just enabling PyO3 itself, but published as a separate crate. |
I think from what I've seen on codecov our coverage stats don't say which extern functions are called (but I could be wrong). |
Another thought - in the future it could be worth adding |
That sounds reasonable to me. Especially since the always-covered test lines "dilute" the actual coverage, i.e. even with zero percent coverage but three times as much test code as production code, I could end up with (0+3N)(N+3N)=3/4=75% coverage. |
My experience is more in Python but most projects I've worked with exclude tests from coverage. I'm not sure if this is just convention or best practice but I'd agree with it for the above reasons. As for FFI I'm also +1 on having tests. I don't think they'd be too be much effort (I'm willing to help), shouldn't need much maintenance, and they would provide some value. That seems like the best option vs. leaving them uncovered or marking |
This issue gathers some areas where we need to improve our test coverage.
You can view pyo3's test coverage online here or locally by following the steps here (do this when writing tests, so you can check them).
In particular (but not limited to) these areas need improvement:
Please keep in mind to write meaningful tests - do not just write tests that take the happy path, but also tests that take error paths or corner cases.
The text was updated successfully, but these errors were encountered: