I have a Rust package which is basically a PyO3
extension. In there I have two files, lib.rs
, that is creating a python module and doing conversions from and into Rust types, and parsing.rs
which is pure Rust code that I'm wrapping. Now the issue I have is running tests where I only want to run unit tests inside parsing.rs
.
When I run cargo test src\parsing.rs
I get an error
my_repo\my_package>cargo test src\parsing.rs
Compiling pyo3-build-config v0.17.3
error: failed to run custom build command for `pyo3-build-config v0.17.3`
Caused by:
process didn't exit successfully: `my_repo\target\debug\build\pyo3-build-config-f455835126268765\build-script-build` (exit code: 1)
--- stdout
cargo:rerun-if-env-changed=PYO3_CONFIG_FILE
cargo:rerun-if-env-changed=PYO3_NO_PYTHON
cargo:rerun-if-env-changed=PYO3_PYTHON
cargo:rerun-if-env-changed=VIRTUAL_ENV
cargo:rerun-if-env-changed=CONDA_PREFIX
cargo:rerun-if-env-changed=PATH
--- stderr
error: no Python 3.x interpreter found
my_repo\my_package>
So my question is how to run unit tests only inside parsing.rs
without triggering anything related to python? For building the whole package, I have a complex setup which uses cmake
instead of maturin
, so that's why I'm targeting only one file.