Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(inference): add fixture library context helper for provider tests

Steven Enamakel8b3a43740fa7
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs
index 2d9fe2f0dc..03a57b3bfa 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_cloud_tests.rs
@@ -98,12 +98,14 @@ fn explicit_cloud_provider_string_routes_to_crate_native_model() {
let _guard = crate::inference::inference_test_guard();
let mut config = Config::default();
config.cloud_providers.push(deepseek_entry("p_ds"));
- let (model, model_id) = create_chat_model_from_string_with_model_id(
- "chat",
- "deepseek:deepseek-reasoner",
- &config,
- 0.7,
- )
+ let (model, model_id) = super::with_fixture_library_context(|| {
+ create_chat_model_from_string_with_model_id(
+ "chat",
+ "deepseek:deepseek-reasoner",
+ &config,
+ 0.7,
+ )
+ })
.expect("explicit cloud model must build");
assert_eq!(model_id, "deepseek-reasoner");
assert_eq!(
@@ -346,6 +348,7 @@ async fn native_claude_turn_routes_disclose_pinned_models() {
#[test]
fn openhuman_jwt_slug_preserves_forced_text_mode() {
let _guard = crate::inference::inference_test_guard();
+ install_test_managed_provider();
let mut config = Config::default();
config.cloud_providers.push(oh_entry("p_oh"));
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
index c64ba60e24..e537d2f839 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_tests.rs
@@ -48,6 +48,15 @@ fn fixture_library_dispatch() -> crate::core::runtime::DispatchCtx {
)
}
+fn with_fixture_library_context<R>(f: impl FnOnce() -> R) -> R {
+ let context = crate::core::runtime::CoreContext::for_test_with_host_kind(
+ crate::core::types::HostKind::Library,
+ crate::core::runtime::DomainSet::full(),
+ None,
+ );
+ crate::core::runtime::CoreContext::sync_scope(context, f)
+}
+
#[test]
fn custom_ca_bundle_builds_a_provider_scoped_chat_client() {
let _guard = crate::inference::inference_test_guard();
diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rs
index ebd3e3180c..88bf8463cb 100644
--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs
@@ -73,6 +73,7 @@ fn install_test_managed_provider() -> Arc<std::sync::Mutex<Vec<bool>>> {
supports_vision: Arc::new(|_| false),
resolve_model: Arc::new(|_, config, model| match model {
Some("hint:reasoning") => Some("fixture/managed-default".into()),
+ Some("reasoning-v1") => Some("fixture/managed-default".into()),
Some(model) if !model.starts_with("hint:") => Some(model.into()),
Some(_) => None,
None => config