mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
chore: adapt instruction tests to current path api
This commit is contained in:
@@ -80,6 +80,7 @@ use codex_rollout::append_rollout_item_to_path;
|
||||
use codex_rollout::read_session_meta_line;
|
||||
use codex_state::StateRuntime;
|
||||
use codex_utils_absolute_path::AbsolutePathBuf;
|
||||
use codex_utils_path_uri::ApiPathString;
|
||||
use core_test_support::responses;
|
||||
use core_test_support::skip_if_no_network;
|
||||
use pretty_assertions::assert_eq;
|
||||
@@ -288,10 +289,7 @@ async fn thread_resume_running_thread_uses_cached_instruction_sources() -> Resul
|
||||
let project_agents = AbsolutePathBuf::try_from(project_agents)?;
|
||||
assert_eq!(
|
||||
instruction_sources,
|
||||
vec![ApiPathString::from_abs_path(
|
||||
&project_agents,
|
||||
PathConvention::native(),
|
||||
)?]
|
||||
vec![ApiPathString::from_abs_path(&project_agents)]
|
||||
);
|
||||
|
||||
let turn_id = mcp
|
||||
@@ -336,10 +334,7 @@ async fn thread_resume_running_thread_uses_cached_instruction_sources() -> Resul
|
||||
|
||||
assert_eq!(
|
||||
instruction_sources,
|
||||
vec![ApiPathString::from_abs_path(
|
||||
&project_agents,
|
||||
PathConvention::native(),
|
||||
)?]
|
||||
vec![ApiPathString::from_abs_path(&project_agents)]
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
@@ -549,14 +549,9 @@ async fn read_agents_md_propagates_metadata_errors() {
|
||||
};
|
||||
|
||||
let cwd = config.cwd.clone();
|
||||
let err = read_agents_md(
|
||||
&config.config,
|
||||
&fs,
|
||||
"local",
|
||||
&PathUri::from_abs_path(&cwd),
|
||||
)
|
||||
.await
|
||||
.expect_err("metadata error");
|
||||
let err = read_agents_md(&config.config, &fs, "local", &PathUri::from_abs_path(&cwd))
|
||||
.await
|
||||
.expect_err("metadata error");
|
||||
|
||||
assert_eq!(err.kind(), io::ErrorKind::PermissionDenied);
|
||||
}
|
||||
@@ -572,14 +567,9 @@ async fn read_agents_md_propagates_read_errors() {
|
||||
};
|
||||
|
||||
let cwd = config.cwd.clone();
|
||||
let err = read_agents_md(
|
||||
&config.config,
|
||||
&fs,
|
||||
"local",
|
||||
&PathUri::from_abs_path(&cwd),
|
||||
)
|
||||
.await
|
||||
.expect_err("read error");
|
||||
let err = read_agents_md(&config.config, &fs, "local", &PathUri::from_abs_path(&cwd))
|
||||
.await
|
||||
.expect_err("read error");
|
||||
|
||||
assert_eq!(err.kind(), io::ErrorKind::PermissionDenied);
|
||||
}
|
||||
@@ -595,14 +585,9 @@ async fn read_agents_md_ignores_files_removed_after_discovery() {
|
||||
};
|
||||
|
||||
let cwd = config.cwd.clone();
|
||||
let loaded = read_agents_md(
|
||||
&config.config,
|
||||
&fs,
|
||||
"local",
|
||||
&PathUri::from_abs_path(&cwd),
|
||||
)
|
||||
.await
|
||||
.expect("removed file is recoverable");
|
||||
let loaded = read_agents_md(&config.config, &fs, "local", &PathUri::from_abs_path(&cwd))
|
||||
.await
|
||||
.expect("removed file is recoverable");
|
||||
|
||||
assert_eq!(loaded, None);
|
||||
}
|
||||
|
||||
@@ -2450,9 +2450,9 @@ mod tests {
|
||||
test_path_buf("/tmp/project").abs(),
|
||||
test_path_buf("/tmp/project/extra").abs(),
|
||||
],
|
||||
instruction_sources: vec![
|
||||
ApiPathString::from_abs_path(&test_path_buf("/tmp/project/AGENTS.md").abs()),
|
||||
],
|
||||
instruction_sources: vec![ApiPathString::from_abs_path(
|
||||
&test_path_buf("/tmp/project/AGENTS.md").abs(),
|
||||
)],
|
||||
approval_policy: codex_app_server_protocol::AskForApproval::Never,
|
||||
approvals_reviewer: codex_app_server_protocol::ApprovalsReviewer::User,
|
||||
sandbox: read_only_profile
|
||||
|
||||
Reference in New Issue
Block a user