Examples of testing rust
I wrote a polars plugin following Marco Gorelli's guide. Pytest works fine, the package installs. maturin develop works, cargo build and cargo test fail.
Between Marco's guide, the maturin docs, and looking at other polars plugins, I can't find examples of how to write rust tests that run and work properly.
My big request is Could you add some rust testing examples and info to the maturin docs?
FWIW the errors I'm running into when running cargo build seem to boil down to
= note: ld: warning: object file (/Users/paddy/code/pl_series_hash/target/debug/deps/libpsm-849cb4a0bab2af53.rlib[4](4f9a91766097c4c5-aarch_aapcs64.o)) was built for newer 'macOS' version (14.0) than being linked (11.0)
ld: Undefined symbols:
_PyBytes_AsString, referenced from:
pyo3::types::bytes::_$LT$impl$u20$pyo3..instance..Borrowed$LT$pyo3..types..bytes..PyBytes$GT$$GT$::as_bytes::hb6a9e9e02edfca55 in libpyo3-e6143a157e3ef6fb.rlib[3](pyo3-e6143a157e3ef6fb.pyo3.b80268539b947e0a-cgu.00.rcgu.o)
Marco's tutorial just mentions maturin, not building with cargo.
Could you add some docs or example projects built with maturin that do rust testing properly?
I just ran into this issue myself, and this solution helped me: https://pyo3.rs/v0.23.0/faq.html#i-cant-run-cargo-test-or-i-cant-build-in-a-cargo-workspace-im-having-linker-issues-like-symbol-not-found-or-undefined-reference-to-_pyexc_systemerror