@@ -279,20 +279,19 @@ impl Into<prost_types::Timestamp> for Instant {
279279
280280#[ cfg( test) ]
281281mod tests {
282- use once_cell:: sync:: Lazy ;
283-
284282 use super :: Instant ;
285283 use crate :: { with_clock, Clock } ;
284+ use serial_test:: serial;
285+ use std:: sync:: LazyLock ;
286286 use std:: time:: Duration ;
287287 use std:: { sync:: Mutex , thread} ;
288288
289- static RECENT_LOCK : Lazy < Mutex < ( ) > > = Lazy :: new ( || Mutex :: new ( ( ) ) ) ;
290-
291289 #[ test]
292290 #[ cfg_attr(
293291 all( target_arch = "wasm32" , target_os = "unknown" ) ,
294292 ignore = "WASM thread cannot sleep"
295293 ) ]
294+ #[ serial]
296295 fn test_now ( ) {
297296 let t0 = Instant :: now ( ) ;
298297 thread:: sleep ( Duration :: from_millis ( 15 ) ) ;
@@ -311,9 +310,8 @@ mod tests {
311310 all( target_arch = "wasm32" , target_os = "unknown" ) ,
312311 ignore = "WASM thread cannot sleep"
313312 ) ]
313+ #[ serial]
314314 fn test_recent ( ) {
315- let _guard = RECENT_LOCK . lock ( ) . unwrap ( ) ;
316-
317315 // Ensures that the recent global value is zero so that the fallback logic can kick in.
318316 crate :: set_recent ( Instant ( 0 ) ) ;
319317
@@ -346,9 +344,8 @@ mod tests {
346344 all( target_arch = "wasm32" , target_os = "unknown" ) ,
347345 wasm_bindgen_test:: wasm_bindgen_test
348346 ) ]
347+ #[ serial]
349348 fn test_mocking ( ) {
350- let _guard = RECENT_LOCK . lock ( ) . unwrap ( ) ;
351-
352349 // Ensures that the recent global value is zero so that the fallback logic can kick in.
353350 crate :: set_recent ( Instant ( 0 ) ) ;
354351
@@ -380,6 +377,7 @@ mod tests {
380377 all( target_arch = "wasm32" , target_os = "unknown" ) ,
381378 wasm_bindgen_test:: wasm_bindgen_test
382379 ) ]
380+ #[ serial]
383381 fn checked_arithmetic_u64_overflow ( ) {
384382 fn nanos_to_dur ( total_nanos : u128 ) -> Duration {
385383 let nanos_per_sec = Duration :: from_secs ( 1 ) . as_nanos ( ) ;
0 commit comments