Files
ocean/backend/tests/conftest.py
T
2026-01-31 11:02:59 +08:00

19 lines
436 B
Python

"""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)