Skip to content

armgit / codex

Public Imported from GitHub
0

Lightweight coding agent that runs in your terminal

Rust

tests: isolate codex home for live cli (#22563)

starr-openai32b45a43e267
diff --git a/codex-rs/core/tests/suite/live_cli.rs b/codex-rs/core/tests/suite/live_cli.rs
index c5c26a1c8e..5e2c0415ea 100644
--- a/codex-rs/core/tests/suite/live_cli.rs
+++ b/codex-rs/core/tests/suite/live_cli.rs
@@ -23,6 +23,9 @@ fn run_live(prompt: &str) -> (assert_cmd::assert::Assert, TempDir) {
use std::thread;
let dir = TempDir::new().unwrap();
+ let home = TempDir::new().unwrap();
+ let codex_home = home.path().join(".codex");
+ std::fs::create_dir_all(&codex_home).unwrap();
// Build a plain `std::process::Command` so we have full control over the underlying stdio
// handles. `assert_cmd`’s own `Command` wrapper always forces stdout/stderr to be piped
@@ -33,6 +36,8 @@ fn run_live(prompt: &str) -> (assert_cmd::assert::Assert, TempDir) {
let mut cmd = Command::new(codex_utils_cargo_bin::cargo_bin("codex-rs").unwrap());
cmd.current_dir(dir.path());
cmd.env("OPENAI_API_KEY", require_api_key());
+ cmd.env("HOME", home.path());
+ cmd.env("CODEX_HOME", &codex_home);
// We want three things at once:
// 1. live streaming of the child’s stdout/stderr while the test is running