From 6733b3600faca2b3fac558a2cff16570da1ff70f Mon Sep 17 00:00:00 2001 From: Alex Clarke Date: Mon, 13 Jul 2026 17:46:34 -0600 Subject: [PATCH] test: Fixed flaky python AST parser test for macOS --- src/parsers/python.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/parsers/python.rs b/src/parsers/python.rs index fae7648..5ed23b3 100644 --- a/src/parsers/python.rs +++ b/src/parsers/python.rs @@ -358,17 +358,16 @@ mod tests { use super::*; use crate::function::JsonSchema; use std::fs; - use std::time::{SystemTime, UNIX_EPOCH}; + use std::sync::atomic::{AtomicU64, Ordering}; + + static PARSE_COUNTER: AtomicU64 = AtomicU64::new(0); fn parse_source( source: &str, file_name: &str, parent: &Path, ) -> Result> { - let unique = SystemTime::now() - .duration_since(UNIX_EPOCH) - .expect("time went backwards") - .as_nanos(); + let unique = PARSE_COUNTER.fetch_add(1, Ordering::Relaxed); let path = std::env::temp_dir().join(format!("coyote_python_parser_{file_name}_{unique}.py")); fs::write(&path, source).expect("failed to write temp python source");