import pytest import os import sys # 添加项目根目录到Python路径 sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # 测试数据库配置 @pytest.fixture(scope="session") def test_db(): # 这里可以设置测试数据库的配置 return { "host": "localhost", "database": "test_prompt_template", "user": "test_user", "password": "test_password" } # 测试客户端配置 @pytest.fixture(scope="session") def test_client(): from flask_prompt_master import create_app app = create_app('testing') return app.test_client()