diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 09fbd0c..4d70a3f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,6 +19,7 @@ jobs: - "3.11" - "3.12" - "3.13" + - "pypy" runs-on: ${{ matrix.platform }} steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index b233f4d..3a01b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Relax cryptography version requirement ([91](https://github.com/trailofbits/rfc3161-client/pull/91)) +### Fixed + +- The project now correctly runs tests with PyPy + ([89](https://github.com/trailofbits/rfc3161-client/pull/89)) + ## [0.1.1] - 2024-12-10 ### Changed 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..0475124 --- /dev/null +++ b/rust/build.rs @@ -0,0 +1,3 @@ +fn main() { + pyo3_build_config::use_pyo3_cfgs(); +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index cf3f98f..1a2d02b 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;