mirror of
https://github.com/instructkr/claw-code.git
synced 2026-04-03 16:04:47 +08:00
fix: add env_lock guard to git discovery tests
This commit is contained in:
@@ -118,7 +118,7 @@ where
|
|||||||
tool_executor,
|
tool_executor,
|
||||||
permission_policy,
|
permission_policy,
|
||||||
system_prompt,
|
system_prompt,
|
||||||
&RuntimeFeatureConfig::default(),
|
RuntimeFeatureConfig::default(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ where
|
|||||||
tool_executor: T,
|
tool_executor: T,
|
||||||
permission_policy: PermissionPolicy,
|
permission_policy: PermissionPolicy,
|
||||||
system_prompt: Vec<String>,
|
system_prompt: Vec<String>,
|
||||||
feature_config: &RuntimeFeatureConfig,
|
feature_config: RuntimeFeatureConfig,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let usage_tracker = UsageTracker::from_session(&session);
|
let usage_tracker = UsageTracker::from_session(&session);
|
||||||
Self {
|
Self {
|
||||||
@@ -140,7 +140,7 @@ where
|
|||||||
system_prompt,
|
system_prompt,
|
||||||
max_iterations: usize::MAX,
|
max_iterations: usize::MAX,
|
||||||
usage_tracker,
|
usage_tracker,
|
||||||
hook_runner: HookRunner::from_feature_config(feature_config),
|
hook_runner: HookRunner::from_feature_config(&feature_config),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ mod tests {
|
|||||||
}),
|
}),
|
||||||
PermissionPolicy::new(PermissionMode::DangerFullAccess),
|
PermissionPolicy::new(PermissionMode::DangerFullAccess),
|
||||||
vec!["system".to_string()],
|
vec!["system".to_string()],
|
||||||
&RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
|
RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
|
||||||
vec![shell_snippet("printf 'blocked by hook'; exit 2")],
|
vec![shell_snippet("printf 'blocked by hook'; exit 2")],
|
||||||
Vec::new(),
|
Vec::new(),
|
||||||
)),
|
)),
|
||||||
@@ -675,7 +675,7 @@ mod tests {
|
|||||||
StaticToolExecutor::new().register("add", |_input| Ok("4".to_string())),
|
StaticToolExecutor::new().register("add", |_input| Ok("4".to_string())),
|
||||||
PermissionPolicy::new(PermissionMode::DangerFullAccess),
|
PermissionPolicy::new(PermissionMode::DangerFullAccess),
|
||||||
vec!["system".to_string()],
|
vec!["system".to_string()],
|
||||||
&RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
|
RuntimeFeatureConfig::default().with_hooks(RuntimeHookConfig::new(
|
||||||
vec![shell_snippet("printf 'pre hook ran'")],
|
vec![shell_snippet("printf 'pre hook ran'")],
|
||||||
vec![shell_snippet("printf 'post hook ran'")],
|
vec![shell_snippet("printf 'post hook ran'")],
|
||||||
)),
|
)),
|
||||||
|
|||||||
@@ -600,6 +600,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn discover_with_git_includes_status_snapshot() {
|
fn discover_with_git_includes_status_snapshot() {
|
||||||
|
let _guard = env_lock();
|
||||||
let root = temp_dir();
|
let root = temp_dir();
|
||||||
fs::create_dir_all(&root).expect("root dir");
|
fs::create_dir_all(&root).expect("root dir");
|
||||||
std::process::Command::new("git")
|
std::process::Command::new("git")
|
||||||
@@ -624,6 +625,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn discover_with_git_includes_diff_snapshot_for_tracked_changes() {
|
fn discover_with_git_includes_diff_snapshot_for_tracked_changes() {
|
||||||
|
let _guard = env_lock();
|
||||||
let root = temp_dir();
|
let root = temp_dir();
|
||||||
fs::create_dir_all(&root).expect("root dir");
|
fs::create_dir_all(&root).expect("root dir");
|
||||||
std::process::Command::new("git")
|
std::process::Command::new("git")
|
||||||
|
|||||||
@@ -1933,7 +1933,7 @@ fn build_runtime(
|
|||||||
CliToolExecutor::new(allowed_tools, emit_output),
|
CliToolExecutor::new(allowed_tools, emit_output),
|
||||||
permission_policy(permission_mode),
|
permission_policy(permission_mode),
|
||||||
system_prompt,
|
system_prompt,
|
||||||
&feature_config,
|
feature_config,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user