From 654616ce503cbc90402d3c5893af5ff83d67a071 Mon Sep 17 00:00:00 2001 From: Adam Reichold Date: Fri, 14 Apr 2023 18:50:32 +0200 Subject: [PATCH] Handle test code that is unused on wasm32. --- src/conversions/chrono.rs | 4 +--- src/conversions/std/num.rs | 1 + src/gil.rs | 4 ++++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/conversions/chrono.rs b/src/conversions/chrono.rs index 934d85fa..374fc161 100644 --- a/src/conversions/chrono.rs +++ b/src/conversions/chrono.rs @@ -847,14 +847,12 @@ mod tests { check_time("non fold", 3, 5, 7, 999_999, 999_999, false); } - #[cfg(test)] + #[cfg(all(test, not(target_arch = "wasm32")))] mod proptests { use super::*; - #[cfg(not(target_arch = "wasm32"))] use proptest::prelude::*; - #[cfg(not(target_arch = "wasm32"))] proptest! { #[test] fn test_duration_roundtrip(days in -999999999i64..=999999999i64) { diff --git a/src/conversions/std/num.rs b/src/conversions/std/num.rs index c3f44111..89e86b8a 100644 --- a/src/conversions/std/num.rs +++ b/src/conversions/std/num.rs @@ -360,6 +360,7 @@ nonzero_int_impl!(NonZeroUsize, usize); #[cfg(test)] mod test_128bit_integers { use super::*; + #[cfg(not(target_arch = "wasm32"))] use crate::types::PyDict; #[cfg(not(target_arch = "wasm32"))] diff --git a/src/gil.rs b/src/gil.rs index 1e203973..217261dc 100644 --- a/src/gil.rs +++ b/src/gil.rs @@ -522,6 +522,7 @@ impl EnsureGIL { mod tests { use super::{gil_is_acquired, GILPool, GIL_COUNT, OWNED_OBJECTS, POOL}; use crate::{ffi, gil, AsPyPointer, IntoPyPointer, PyObject, Python, ToPyObject}; + #[cfg(not(target_arch = "wasm32"))] use parking_lot::{const_mutex, Condvar, Mutex}; use std::{ptr::NonNull, sync::atomic::Ordering}; @@ -543,6 +544,7 @@ mod tests { !POOL.dirty.load(Ordering::SeqCst) } + #[cfg(not(target_arch = "wasm32"))] fn pool_dirty_with( inc_refs: Vec>, dec_refs: Vec>, @@ -766,11 +768,13 @@ mod tests { assert_eq!(count + 1, c.get_refcnt(py)); } + #[cfg(not(target_arch = "wasm32"))] struct Event { set: Mutex, wait: Condvar, } + #[cfg(not(target_arch = "wasm32"))] impl Event { const fn new() -> Self { Self {