| 1234567891011121314151617181920212223242526272829303132 |
- """
- RAG 管线测试 — pytest fixtures
- """
- import pytest
- @pytest.fixture(scope="session")
- def pipeline_runner():
- """RAG 管线执行器(session 级,避免重复初始化)"""
- from utils_test.RAG_Pipeline_Test.rag_pipeline_runner import RAGPipelineRunner
- return RAGPipelineRunner()
- @pytest.fixture(scope="session")
- def evaluator():
- """RAG 评估器(session 级)"""
- from utils_test.RAG_Pipeline_Test.rag_evaluator import RAGEvaluator
- return RAGEvaluator()
- @pytest.fixture(scope="session")
- def test_samples():
- """测试样本列表"""
- from utils_test.RAG_Pipeline_Test.test_data import TEST_SAMPLES
- return TEST_SAMPLES
- @pytest.fixture(scope="session")
- def batch_results(pipeline_runner, test_samples):
- """批量执行所有测试样本(session 级,所有测试共享结果)"""
- return pipeline_runner.run_batch(test_samples)
|