()
| 45 | /// parallel test threads never race a first import of `asyncio`. |
| 46 | #[cfg(test)] |
| 47 | pub(crate) fn initialize_python() { |
| 48 | static IMPORTED: std::sync::Once = std::sync::Once::new(); |
| 49 | pyo3::Python::initialize(); |
| 50 | IMPORTED.call_once(|| { |
| 51 | pyo3::Python::attach(|py| { |
| 52 | py.import("asyncio").expect("asyncio imports"); |
| 53 | }); |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | #[cfg(test)] |
| 58 | pub(crate) struct InitializedPython; |