fix: tolerate Windows delete-pending memory files in tests

Co-authored-by: Codex noreply@openai.com
This commit is contained in:
viyatb-oai
2026-05-07 16:19:47 -07:00
parent d7b2dbac52
commit 56252b1023

View File

@@ -365,8 +365,13 @@ async fn wait_for_single_request(mock: &ResponseMock) -> ResponsesRequest {
async fn wait_for_file_removed(path: &Path) -> anyhow::Result<()> {
let deadline = Instant::now() + Duration::from_secs(10);
loop {
if !tokio::fs::try_exists(path).await? {
return Ok(());
match tokio::fs::try_exists(path).await {
Ok(false) => return Ok(()),
Ok(true) => {}
Err(err)
if cfg!(target_os = "windows")
&& err.kind() == std::io::ErrorKind::PermissionDenied => {}
Err(err) => return Err(err.into()),
}
assert!(
Instant::now() < deadline,