Handle test code that is unused on wasm32.

This commit is contained in:
Adam Reichold 2023-04-14 18:50:32 +02:00
parent 452c971023
commit 654616ce50
3 changed files with 6 additions and 3 deletions

View file

@ -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) {

View file

@ -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"))]

View file

@ -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<NonNull<ffi::PyObject>>,
dec_refs: Vec<NonNull<ffi::PyObject>>,
@ -766,11 +768,13 @@ mod tests {
assert_eq!(count + 1, c.get_refcnt(py));
}
#[cfg(not(target_arch = "wasm32"))]
struct Event {
set: Mutex<bool>,
wait: Condvar,
}
#[cfg(not(target_arch = "wasm32"))]
impl Event {
const fn new() -> Self {
Self {