feat(phase0): 工具链 + 契约快照测试,修复既有 bug

- 新增 pyproject.toml / pytest.ini / Makefile / requirements-dev.txt
- 新增 3 个契约快照测试(路由167/权限串148/表名25),守护前端与数据契约
- 修复 requirements.txt UTF-16 编码导致 pip 无法解析
- 修复 JobLog 未继承 Base 导致无法映射(fastapi_job_log 表缺失于 metadata)
- 修复 base_model.to_dict() 未序列化纯 date 类型(birthday 等导致 500)
- 补充 .gitignore(.env/缓存/上传目录)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-08-07 09:57:33 +08:00
co-authored by Claude
parent dbcce79536
commit fe1d191e55
15 changed files with 504 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
# DjangoAdmin FastAPI+EleVue 常用命令
# Windows 无 make 时可用:python -m pytest / python main.py 等直接执行
.PHONY: install dev test test-contract test-unit test-integration lint
# 安装依赖(运行 + 开发)
install:
pip install -r requirements.txt -r requirements-dev.txt
# 启动开发服务
dev:
python main.py
# 全部测试(默认跳过 integration)
test:
pytest
# 契约快照测试
test-contract:
pytest tests/contract -m contract
# 单元测试
test-unit:
pytest tests/unit
# 集成测试(需真实 MySQL/Redis)
test-integration:
pytest tests/integration -m integration
# 静态检查(需 pip install ruff)
lint:
ruff check .