chore: P1 工程化工具链

- pyproject.toml:pytest/black/isort/mypy 统一配置
- requirements-dev.txt:测试与代码规范开发依赖
- .flake8 / .editorconfig:PEP8 与编辑器统一
- .pre-commit-config.yaml:提交前钩子
- Makefile:常用命令集
- .env.example:环境变量模板(76 键)
- tests/:pytest 骨架 + R 响应格式冒烟测试

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DjangoAdmin Dev
2026-08-07 12:14:51 +08:00
co-authored by Claude
parent 15f2a5e097
commit 8691412ec6
12 changed files with 448 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
"""
pytest 全局配置
=============================================================
P1 阶段仅搭建骨架,保证 `pytest` 可空跑。
测试 App 构建、数据库/Redis fixture 在 P8(测试完善阶段)补充:
- app fixture:create_app() + 测试库 DATABASE_URL 覆盖
- db fixture:事务内建表/清库
- client fixture:Flask test_client
"""
import os
import sys
# 项目根目录加入 sys.path(tests/ 已有 __init__.py 时 pytest 通常自动处理,
# 此处显式补充,兼容从任意目录启动 pytest 的场景)
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if ROOT not in sys.path:
sys.path.insert(0, ROOT)