Skip to content

Commit

Permalink
Fix running test on PyPy
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaMaul committed Dec 11, 2024
1 parent cc26c8a commit 168ceee
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
3 changes: 3 additions & 0 deletions rust/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
pyo3_build_config::use_pyo3_cfgs();
}
4 changes: 4 additions & 0 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -781,5 +784,6 @@ mod tests {

assert_eq!(raw.borrow_dependent().status.status, 0);
});

}
}

0 comments on commit 168ceee

Please sign in to comment.