diff --git a/Cargo.lock b/Cargo.lock index 16b6ea8..0e6bb99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,6 +372,7 @@ dependencies = [ "hex", "openssl", "pyo3", + "pyo3-build-config", "rand", "self_cell", "sha2", diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 95cb227..ac944c0 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -21,5 +21,8 @@ rand = "0.8.5" cryptography-x509.workspace = true openssl = { version = "0.10.68", features = ["vendored"] } +[build-dependencies] +pyo3-build-config = { version = "0.23.1", features = ["resolve-config"] } + [features] extension-module = ["pyo3/extension-module"] diff --git a/rust/build.rs b/rust/build.rs new file mode 100644 index 0000000..8756b7d --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,3 @@ +fn main() { + pyo3_build_config::use_pyo3_cfgs(); +} \ No newline at end of file diff --git a/rust/src/lib.rs b/rust/src/lib.rs index cf3f98f..6f9ee0d 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -760,6 +760,9 @@ mod _rust { } } +// We cannot run tests when used with PyPy because it lacks Py_Initialize +// https://github.com/pypy/pypy/issues/3836 +#[cfg(not(PyPy))] #[cfg(test)] mod tests { use super::OwnedTimeStampResp; @@ -781,5 +784,6 @@ mod tests { assert_eq!(raw.borrow_dependent().status.status, 0); }); + } }