The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(config): move test support into its own module
Steven Enamakelc8a9a0042e4c
diff --git a/crates/openhuman-core/src/config/schema/load/source/mod.rs b/crates/openhuman-core/src/config/schema/load/source/mod.rsindex 0bf35d5185..0fc21fa0b5 100644--- a/crates/openhuman-core/src/config/schema/load/source/mod.rs+++ b/crates/openhuman-core/src/config/schema/load/source/mod.rs@@ -131,36 +131,7 @@ pub(crate) fn apply_bootstrap(stored: &str, bootstrap_text: Option<&str>) -> Res}#[cfg(test)]-pub(crate) mod tests_support {- //! Test seam: force the document source for the current thread without- //! installing a process-wide backend that every other test would see.- use crate::storage::ScopedStorage;- use std::cell::RefCell;-- thread_local! {- static FORCED: RefCell<Option<(ScopedStorage, String)>> = const { RefCell::new(None) };- }-- pub(crate) fn forced_document_scope() -> Option<(ScopedStorage, String)> {- FORCED.with(|forced| forced.borrow().clone())- }-- /// Forces the document source on this thread until the guard drops.- pub(crate) struct ForcedDocumentSource;-- impl ForcedDocumentSource {- pub(crate) fn new(scoped: ScopedStorage, scope: &str) -> Self {- FORCED.with(|forced| *forced.borrow_mut() = Some((scoped, scope.to_string())));- Self- }- }-- impl Drop for ForcedDocumentSource {- fn drop(&mut self) {- FORCED.with(|forced| *forced.borrow_mut() = None);- }- }-}+pub(crate) mod tests_support;#[cfg(test)]#[path = "mod_tests.rs"]diff --git a/crates/openhuman-core/src/config/schema/load/source/tests_support.rs b/crates/openhuman-core/src/config/schema/load/source/tests_support.rsnew file mode 100644index 0000000000..965ad449da--- /dev/null+++ b/crates/openhuman-core/src/config/schema/load/source/tests_support.rs@@ -0,0 +1,28 @@+//! Test seam: force the document source for the current thread without+//! installing a process-wide backend that every other test would see.+use crate::storage::ScopedStorage;+use std::cell::RefCell;++thread_local! {+ static FORCED: RefCell<Option<(ScopedStorage, String)>> = const { RefCell::new(None) };+}++pub(crate) fn forced_document_scope() -> Option<(ScopedStorage, String)> {+ FORCED.with(|forced| forced.borrow().clone())+}++/// Forces the document source on this thread until the guard drops.+pub(crate) struct ForcedDocumentSource;++impl ForcedDocumentSource {+ pub(crate) fn new(scoped: ScopedStorage, scope: &str) -> Self {+ FORCED.with(|forced| *forced.borrow_mut() = Some((scoped, scope.to_string())));+ Self+ }+}++impl Drop for ForcedDocumentSource {+ fn drop(&mut self) {+ FORCED.with(|forced| *forced.borrow_mut() = None);+ }+}