Add non_sandbox_test helper (#3880)

Makes tests shorter
This commit is contained in:
pakrym-oai
2025-09-22 07:50:41 -07:00
committed by GitHub
parent 5996ee0e5f
commit 14a115d488
14 changed files with 99 additions and 223 deletions

View File

@@ -126,3 +126,21 @@ where
}
}
}
#[macro_export]
macro_rules! non_sandbox_test {
// For tests that return ()
() => {{
if ::std::env::var("CODEX_SANDBOX_NETWORK_DISABLED").is_ok() {
println!("Skipping test because it cannot execute when network is disabled in a Codex sandbox.");
return;
}
}};
// For tests that return Result<(), _>
(result $(,)?) => {{
if ::std::env::var("CODEX_SANDBOX_NETWORK_DISABLED").is_ok() {
println!("Skipping test because it cannot execute when network is disabled in a Codex sandbox.");
return ::core::result::Result::Ok(());
}
}};
}