mirror of
https://github.com/openai/codex.git
synced 2026-11-03 19:53:25 +00:00
Update tests for lazy code mode sessions
This commit is contained in:
@@ -273,6 +273,22 @@ async fn missing_code_mode_wait_traces_only_the_wait_tool_call() -> anyhow::Resu
|
||||
session.services.code_mode_service =
|
||||
crate::tools::code_mode::CodeModeService::new(Arc::clone(&provider));
|
||||
session.services.code_mode_session_provider = provider;
|
||||
assert_eq!(
|
||||
session
|
||||
.services
|
||||
.code_mode_service
|
||||
.execute(ExecuteRequest {
|
||||
tool_call_id: "setup-call".to_string(),
|
||||
enabled_tools: Vec::new(),
|
||||
source: String::new(),
|
||||
yield_time_ms: None,
|
||||
max_output_tokens: None,
|
||||
})
|
||||
.await
|
||||
.err()
|
||||
.as_deref(),
|
||||
Some("execute is not supported by this test session")
|
||||
);
|
||||
attach_test_trace(&mut session, &turn, temp.path())?;
|
||||
|
||||
let registry = ToolRegistry::with_handler_for_test(Arc::new(CodeModeWaitHandler));
|
||||
|
||||
@@ -1866,7 +1866,7 @@ text("after terminate");
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn code_mode_wait_returns_error_for_unknown_session() -> Result<()> {
|
||||
async fn code_mode_wait_returns_error_without_a_session() -> Result<()> {
|
||||
skip_if_no_network!(Ok(()));
|
||||
|
||||
let server = responses::start_mock_server().await;
|
||||
@@ -1909,17 +1909,10 @@ async fn code_mode_wait_returns_error_for_unknown_session() -> Result<()> {
|
||||
assert_ne!(success, Some(true));
|
||||
|
||||
let items = function_tool_output_items(&request, "call-1");
|
||||
assert_eq!(items.len(), 2);
|
||||
assert_regex_match(
|
||||
concat!(
|
||||
r"(?s)\A",
|
||||
r"Script failed\nWall time \d+\.\d seconds\nOutput:\n\z"
|
||||
),
|
||||
text_item(&items, /*index*/ 0),
|
||||
);
|
||||
assert_eq!(items.len(), 1);
|
||||
assert_eq!(
|
||||
text_item(&items, /*index*/ 1),
|
||||
"Script error:\nexec cell 999999 not found"
|
||||
text_item(&items, /*index*/ 0),
|
||||
"code mode session is unavailable"
|
||||
);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user