Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
test(resource): isolate service fixtures (#3203)
huangruiteng7d48a230e6a9
diff --git a/tests/misc/test_resource_processor_mv.py b/tests/misc/test_resource_processor_mv.pyindex fedc85edf..b364be0bc 100644--- a/tests/misc/test_resource_processor_mv.py+++ b/tests/misc/test_resource_processor_mv.py@@ -118,10 +118,18 @@ class _FakeVikingFS:self.persist_calls.append((temp_uri, target_uri))self.agfs.write(self._uri_to_path(target_uri, ctx=ctx), b"content")+ async def glob(self, pattern, uri=None, ctx=None):+ return {"matches": []}+def _uri_to_path(self, uri, ctx=None):return f"/mock/{uri.replace('viking://', '')}"+def _patch_viking_fs(monkeypatch, fake_fs):+ monkeypatch.setattr("openviking.utils.resource_processor.get_viking_fs", lambda: fake_fs)+ monkeypatch.setattr("openviking.parse.image_rewrite.get_viking_fs", lambda: fake_fs)++@pytest.mark.asyncioasync def test_resource_processor_first_add_summarizes_from_committed_uri(monkeypatch):from openviking.utils.resource_processor import ResourceProcessor@@ -134,7 +142,7 @@ async def test_resource_processor_first_add_summarizes_from_committed_uri(monkey"openviking.utils.resource_processor.get_current_telemetry",lambda: _DummyTelemetry(),)- monkeypatch.setattr("openviking.utils.resource_processor.get_viking_fs", lambda: fake_fs)+ _patch_viking_fs(monkeypatch, fake_fs)monkeypatch.setattr("openviking.storage.transaction.get_lock_manager",lambda: fake_lock_manager,@@ -186,7 +194,7 @@ async def test_resource_processor_second_add_preserves_temp_uri_for_incremental("openviking.utils.resource_processor.get_current_telemetry",lambda: _DummyTelemetry(),)- monkeypatch.setattr("openviking.utils.resource_processor.get_viking_fs", lambda: fake_fs)+ _patch_viking_fs(monkeypatch, fake_fs)monkeypatch.setattr("openviking.storage.transaction.get_lock_manager",lambda: fake_lock_manager,@@ -237,7 +245,7 @@ async def test_resource_processor_auto_candidate_skips_existing_and_busy(monkeyp"openviking.utils.resource_processor.get_current_telemetry",lambda: _DummyTelemetry(),)- monkeypatch.setattr("openviking.utils.resource_processor.get_viking_fs", lambda: fake_fs)+ _patch_viking_fs(monkeypatch, fake_fs)monkeypatch.setattr("openviking.storage.transaction.get_lock_manager",lambda: fake_lock_manager,diff --git a/tests/service/test_resource_service_watch.py b/tests/service/test_resource_service_watch.pyindex 613f4f328..5e3aec987 100644--- a/tests/service/test_resource_service_watch.py+++ b/tests/service/test_resource_service_watch.py@@ -57,7 +57,11 @@ class MockVikingDB:class NoopTaskTracker:+ def __init__(self):+ self._count = 0+async def create(self, *_args, **_kwargs):+ self._count += 1return SimpleNamespace(task_id="test-task")async def start(self, *_args, **_kwargs):@@ -66,6 +70,9 @@ class NoopTaskTracker:async def complete(self, *_args, **_kwargs):pass+ def count(self):+ return self._count+def disable_task_tracker(monkeypatch: pytest.MonkeyPatch) -> None:monkeypatch.setattr(@@ -74,6 +81,16 @@ def disable_task_tracker(monkeypatch: pytest.MonkeyPatch) -> None:)[email protected](autouse=True)+def isolate_service_dependencies(monkeypatch: pytest.MonkeyPatch) -> None:+ task_tracker = NoopTaskTracker()+ monkeypatch.setattr(+ "openviking.service.task_tracker.get_task_tracker",+ lambda: task_tracker,+ )+ monkeypatch.setattr(resource_service_module, "is_git_repo_url", lambda _path: False)++@pytest_asyncio.fixtureasync def watch_manager() -> AsyncGenerator[WatchManager, None]:"""Create WatchManager instance without VikingFS for testing."""