Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

test: fix root collection boundary and CLI fixture pollution (#4087)

wutongyuonceeaa2c4a77306
diff --git a/pyproject.toml b/pyproject.toml
index defbab250..0f1d38aeb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -253,8 +253,10 @@ python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
asyncio_mode = "auto"
+norecursedirs = ["api_test", "oc2ov_test"]
markers = [
"integration: tests that require external services or real model configuration",
+ "cli_remote: tests that require a remote OpenViking CLI binary and server connection",
]
addopts = "-v --cov=openviking --cov-report=term-missing"
diff --git a/tests/cli/conftest.py b/tests/cli/conftest.py
index f0116cd28..fc1bc89aa 100644
--- a/tests/cli/conftest.py
+++ b/tests/cli/conftest.py
@@ -607,7 +607,16 @@ def _find_file_in_pack(pack_uri, retries=10, interval=5):
return None
[email protected](scope="session", autouse=True)
+def pytest_collection_modifyitems(items):
+ for item in items:
+ if (
+ item.get_closest_marker("cli_remote")
+ and "ensure_resources_dir" not in item.fixturenames
+ ):
+ item.fixturenames.append("ensure_resources_dir")
+
+
[email protected](scope="session")
def ensure_resources_dir():
r = ov_mkdir("viking://resources")
if r["exit_code"] != 0:
diff --git a/tests/integration/test_gemini_e2e.py b/tests/integration/test_gemini_e2e.py
index da8c6a906..0b390db00 100644
--- a/tests/integration/test_gemini_e2e.py
+++ b/tests/integration/test_gemini_e2e.py
@@ -8,6 +8,8 @@ Run: pytest tests/integration/test_gemini_e2e.py -v -m integration
import pytest
+pytest.importorskip("google.genai")
+
from openviking.models.embedder.gemini_embedders import GeminiDenseEmbedder
from tests.integration.conftest import GOOGLE_API_KEY, l2_norm, requires_api_key
diff --git a/tests/session/test_session_lifecycle.py b/tests/session/test_session_lifecycle.py
index ffcb3a66c..f03274a7b 100644
--- a/tests/session/test_session_lifecycle.py
+++ b/tests/session/test_session_lifecycle.py
@@ -4,6 +4,7 @@
"""Session lifecycle tests"""
import re
+from functools import partial
from openviking.server.identity import RequestContext
from openviking.service.core import OpenVikingService
@@ -90,8 +91,8 @@ class TestSessionLoad:
# Nonexistent session should be empty after loading
assert len(session.messages) == 0
- async def test_load_ignores_non_archive_history_entries(self, client: AsyncOpenViking):
- session = client.session(session_id="archive_name_validation_test")
+ async def test_load_ignores_non_archive_history_entries(self, client: partial):
+ session = client(session_id="archive_name_validation_test")
for name in ("archive_001", "archive_002", "archive_001.bak.20260628"):
await session._viking_fs.mkdir(
f"{session.uri}/history/{name}",
@@ -99,7 +100,7 @@ class TestSessionLoad:
ctx=session.ctx,
)
- loaded = client.session(session_id=session.session_id)
+ loaded = client(session_id=session.session_id)
await loaded.load()
assert loaded.compression.compression_index == 2