test(onboard): isolate quick setup env vars in tests

This commit is contained in:
Chummy 2026-02-25 02:44:22 +00:00 committed by Chum Yin
parent 97bd12c26a
commit a797b5456c

View File

@ -5790,6 +5790,29 @@ mod tests {
}
}
async fn run_quick_setup_with_clean_env(
credential_override: Option<&str>,
provider: Option<&str>,
model_override: Option<&str>,
memory_backend: Option<&str>,
force: bool,
home: &Path,
) -> Result<Config> {
let _env_guard = env_lock().lock().await;
let _workspace_env = EnvVarGuard::unset("ZEROCLAW_WORKSPACE");
let _config_env = EnvVarGuard::unset("ZEROCLAW_CONFIG_DIR");
run_quick_setup_with_home(
credential_override,
provider,
model_override,
memory_backend,
force,
home,
)
.await
}
// ── ProjectContext defaults ──────────────────────────────────
#[test]
@ -5856,7 +5879,7 @@ mod tests {
async fn quick_setup_model_override_persists_to_config_toml() {
let tmp = TempDir::new().unwrap();
let config = run_quick_setup_with_home(
let config = run_quick_setup_with_clean_env(
Some("sk-issue946"),
Some("openrouter"),
Some("custom-model-946"),
@ -5880,7 +5903,7 @@ mod tests {
async fn quick_setup_without_model_uses_provider_default_model() {
let tmp = TempDir::new().unwrap();
let config = run_quick_setup_with_home(
let config = run_quick_setup_with_clean_env(
Some("sk-issue946"),
Some("anthropic"),
None,
@ -5907,7 +5930,7 @@ mod tests {
.await
.unwrap();
let err = run_quick_setup_with_home(
let err = run_quick_setup_with_clean_env(
Some("sk-existing"),
Some("openrouter"),
Some("custom-model"),
@ -5937,7 +5960,7 @@ mod tests {
.await
.unwrap();
let config = run_quick_setup_with_home(
let config = run_quick_setup_with_clean_env(
Some("sk-force"),
Some("openrouter"),
Some("custom-model-fresh"),