完成错误测试用例

This commit is contained in:
Your Name
2026-01-31 11:02:59 +08:00
parent 588e3bb478
commit 11cef531bd
15 changed files with 909 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
"""pytest 配置与公共 fixture(依据 API 文档)"""
import pytest
from fastapi.testclient import TestClient
from app import app, PROJECTS, OPERATION_LOGS
@pytest.fixture(autouse=True)
def reset_store():
"""每个测试前清空内存存储,保证隔离"""
PROJECTS.clear()
OPERATION_LOGS.clear()
yield
@pytest.fixture
def client():
"""同步测试用:FastAPI TestClient"""
return TestClient(app)