From fff935c6a7ebad1e9cd714c5b34465a61c4c7a42 Mon Sep 17 00:00:00 2001 From: Mike Foster Date: Tue, 7 May 2024 06:37:17 +0000 Subject: [PATCH] Add note that py3.9 required to run tests to avoid: `ImportError: PyO3 modules compiled for CPython 3.8 or older may only be initialized once per interpreter process` --- guide/src/testing.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/guide/src/testing.md b/guide/src/testing.md index 526b2847051..0fc2c70b341 100644 --- a/guide/src/testing.md +++ b/guide/src/testing.md @@ -114,6 +114,10 @@ fn test_one_plus_one_wrapped() { `#[pyo3test]` takes care of wrapping the whole test case in `Python::with_gil(|py| {...})` and making `addone` available in Rust. +> **Note:** running multiple tests which `#[pyo3import]` the same wrapped module requires _at least python3.9_. +> +> This does not affect which systems you can build and release for, only the interpreter used for these tests. + In a non-trivial case, you will likely have Type conversions and Error handling which you wish to validate at this point.