From debd807416eb607817770df38c294be09220b022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=A6=82=E5=A8=81?= Date: Wed, 7 Jan 2026 10:05:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pipeline/core}/test_nodes.py | 25 ++++++++++++------- .../pipeline/core}/test_utils.py | 0 2 files changed, 16 insertions(+), 9 deletions(-) rename {src/tests => tests/pipeline/core}/test_nodes.py (93%) rename {src/tests => tests/pipeline/core}/test_utils.py (100%) diff --git a/src/tests/test_nodes.py b/tests/pipeline/core/test_nodes.py similarity index 93% rename from src/tests/test_nodes.py rename to tests/pipeline/core/test_nodes.py index dca5a71..2ec945f 100644 --- a/src/tests/test_nodes.py +++ b/tests/pipeline/core/test_nodes.py @@ -8,11 +8,21 @@ from src.pipeline.core import llm, es, nodes, utils from src.pipeline.core.skills import load_skills -@pytest.mark.asyncio -async def test_embedding(): +@pytest.fixture(scope="session") +async def init_llm(): await llm.init_client() - await es.init_client() + yield + await llm.close_client() + +@pytest.fixture(scope="session") +async def init_es(): + await es.init_client() + yield + await es.close_client() + +@pytest.mark.asyncio +async def test_embedding(init_llm, init_es): logger.debug("file to es") shared = { @@ -32,12 +42,9 @@ async def test_embedding(): logger.debug(json.dumps([{**x, "embedding":x["embedding"][:4]} for x in shared["documents"]], indent=4, ensure_ascii=False)) - await llm.close_client() - await es.close_client() - @pytest.mark.asyncio -async def test_search(): +async def test_search(init_llm, init_es): await llm.init_client() await es.init_client() logger.debug("search from es") @@ -73,7 +80,7 @@ async def test_search(): @pytest.mark.asyncio -async def test_rerank(): +async def test_rerank(init_llm, init_es): await llm.init_client() await es.init_client() logger.debug("search from es") @@ -113,7 +120,7 @@ async def test_rerank(): @pytest.mark.asyncio -async def test_agent(): +async def test_agent(init_llm, init_es): await llm.init_client() await es.init_client() diff --git a/src/tests/test_utils.py b/tests/pipeline/core/test_utils.py similarity index 100% rename from src/tests/test_utils.py rename to tests/pipeline/core/test_utils.py