mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-20 20:39:55 +00:00
refactor: 优化代码结构和可读性 feat: 添加http_limit模块实现请求限制功能 fix: 修复异步任务中使用time.sleep的问题 chore: 更新依赖项并添加pytest测试框架 docs: 更新项目描述信息 perf: 优化Redis序列化方式使用JSON替代pickle test: 添加测试相关配置和依赖
20 lines
387 B
Python
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
|