Files
FastapiAdmin/backend/tests/conftest.py
T
zhangtao 1d54dca76c style: 统一代码格式和字符串引号使用
refactor: 优化代码结构和可读性

feat: 添加http_limit模块实现请求限制功能

fix: 修复异步任务中使用time.sleep的问题

chore: 更新依赖项并添加pytest测试框架

docs: 更新项目描述信息

perf: 优化Redis序列化方式使用JSON替代pickle

test: 添加测试相关配置和依赖
2026-01-17 20:07:25 +08:00

20 lines
387 B
Python

import os
import sys
import pytest
from fastapi.testclient import TestClient
# 导入 main 模块,确保路径正确
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
from main import create_app
# 创建测试客户端
app = create_app()
@pytest.fixture(scope="module")
def test_client():
with TestClient(app) as client:
yield client