Closed nth10sd closed 1 year ago
Macro attributes are already meant to be ignored, so there's something wrong in the source analysis module there. If you have a repo I can look at I'll see if I can spot it out
use pyo3::prelude::{pyfunction, PyResult};
#[pyfunction]
pub fn print_something() -> PyResult<()> {
println!("foo");
Ok(())
}
#[cfg(test)]
mod mod_test_print_something {
use super::print_something;
#[test]
fn test_print_something() {
print_something().ok().unwrap()
}
}
Here's an extract. The only line that tarpaulin
claims to not cover is the #[pyfunction]
one.
https://github.com/xd009642/tarpaulin/pull/1384 draft PR started, I'll add it on impl blocks, methods and traits as well
Okay done and released, you can reopen this if you still think there's a need for the pragma comments, but the macros should apply to everything in rust that isn't a macro/attribute so I have a feeling there's no need provided tarpaulin ignores attributes etc correctly
Okay done and released
@xd009642 I've retested with version 0.27.0, yes, you've fixed this issue as the pyfunction
macro is now covered!
Please feel free to rename this issue to something more appropriate.
# pragma: no cover
allows coverage.py users to specify a particular line to ignore in code coverage.May I know if there's a equivalent in
tarpaulin
? My use case is inmaturin
repositories, which use#[pyfunction]
macros. Tarpaulin marks these#[pyfunction]
macro lines as being not covered and I'd like to ignore them intarpaulin
reports.The current way of ignoring via
#[cfg(not(tarpaulin_include))]
only allows ignoring whole functions, not specific macro lines.