In a project which contains a subcrate which creates python modules with PyO3
, many tests are most naturally expressed in a python testing framework such as pytest
. Is it possible to get cargo test
to execute these, and at least include their status in a single overall pass/fail status, or better still, some pass/fail statistics?
If you are interested in running an external command as part of test, you can do it like this:
#[cfg(test)]
mod tests {
#[test]
fn pytest() {
let o = std::process::Command::new("pytest").output().unwrap();
println!("stdout: {:?}", o.stdout);
println!("stderr: {:?}", o.stderr);
assert!(o.status.success())
}
}
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.