Skip to content

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

test(inference): update test function signatures and logic

Steven Enamakel7bdf01f78820
diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs
index eee49063d7..f723413633 100644
--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs
@@ -8,35 +8,39 @@ fn crate_native_chat_model_factory_preserves_invalid_route_diagnostics() {
super::with_library_test_context(|| {
let config = Config::default();
- let unconfigured =
- create_chat_model_from_string_with_model_id("reasoning", "groq:llama3", &config, 0.7)
- .err()
- .expect("unconfigured slug must fail")
- .to_string();
- assert!(
- unconfigured.contains("no cloud provider configured for slug 'groq'"),
- "unexpected diagnostic: {unconfigured}"
- );
+ let unconfigured =
+ create_chat_model_from_string_with_model_id("reasoning", "groq:llama3", &config, 0.7)
+ .err()
+ .expect("unconfigured slug must fail")
+ .to_string();
+ assert!(
+ unconfigured.contains("no cloud provider configured for slug 'groq'"),
+ "unexpected diagnostic: {unconfigured}"
+ );
- let bare =
- create_chat_model_from_string_with_model_id("reasoning", "unknown-provider", &config, 0.7)
- .err()
- .expect("bare unknown provider must fail")
- .to_string();
- assert!(
- bare.contains("unrecognised provider string 'unknown-provider'"),
- "unexpected diagnostic: {bare}"
- );
+ let bare = create_chat_model_from_string_with_model_id(
+ "reasoning",
+ "unknown-provider",
+ &config,
+ 0.7,
+ )
+ .err()
+ .expect("bare unknown provider must fail")
+ .to_string();
+ assert!(
+ bare.contains("unrecognised provider string 'unknown-provider'"),
+ "unexpected diagnostic: {bare}"
+ );
- let byok = create_chat_model_from_string_with_model_id(
- "reasoning",
- BYOK_INCOMPLETE_SENTINEL,
- &config,
- 0.7,
- )
- .err()
- .expect("incomplete BYOK must fail")
- .to_string();
+ let byok = create_chat_model_from_string_with_model_id(
+ "reasoning",
+ BYOK_INCOMPLETE_SENTINEL,
+ &config,
+ 0.7,
+ )
+ .err()
+ .expect("incomplete BYOK must fail")
+ .to_string();
assert!(
byok.contains("BYOK_INCOMPLETE"),
"unexpected diagnostic: {byok}"
diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rs
index 9731a66cf6..ca536c5588 100644
--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs
+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs
@@ -13,7 +13,9 @@ fn with_library_test_context<T>(f: impl FnOnce() -> T) -> T {
crate::core::runtime::CoreContext::sync_scope(context, f)
}
-async fn with_library_test_context_async<F: std::future::Future>(f: impl FnOnce() -> F) -> F::Output {
+async fn with_library_test_context_async<F: std::future::Future>(
+ f: impl FnOnce() -> F,
+) -> F::Output {
let context = crate::core::runtime::CoreContext::for_test_with_host_kind(
crate::core::types::HostKind::Library,
crate::core::runtime::DomainSet::full(),
diff --git a/crates/openhuman-core/src/inference/turn_models_native_tests.rs b/crates/openhuman-core/src/inference/turn_models_native_tests.rs
index 448ab40493..7893f21b43 100644
--- a/crates/openhuman-core/src/inference/turn_models_native_tests.rs
+++ b/crates/openhuman-core/src/inference/turn_models_native_tests.rs
@@ -343,7 +343,7 @@ async fn injected_turn_without_profile_keeps_conservative_capabilities() {
)
.host_overrides(Arc::new(overrides)),
);
- let ctx = DispatchCtx::new(context);
+ let ctx = DispatchCtx::new(context.clone());
let models = CoreContext::scope(context, async {
TurnModelSource::new_crate_native(&ctx, "chat", Arc::new(Default::default()))
.build("hint:chat", 0.2, None, None)