test: 全面迁移 pytest 并加入格式门禁

This commit is contained in:
yml2213
2026-08-30 19:19:32 +08:00
parent 3ce1c7a51b
commit 13b5aedd1d
26 changed files with 1374 additions and 888 deletions
+12 -2
View File
@@ -115,6 +115,10 @@ uv run --group dev pytest # 或 ./dev.sh test
# 只跑单个文件 / 用例
uv run --group dev pytest tests/test_cookie_operations.py
# 格式化 / 仅检查格式
./dev.sh format tests conftest.py
./dev.sh format-check tests conftest.py
# 容器内回归(镜像内为构建时代码,改动后需重新构建)
docker compose --profile test run --rm test
```
@@ -125,8 +129,14 @@ docker compose --profile test run --rm test
编译 + 空库整链 `upgrade head` 后与模型元数据表/列/索引对齐;MySQL
专属 DDL 由迁移脚本内的方言防护跳过,真实执行仍以部署流程
`docker-entrypoint.sh` / `./deploy.sh` / `./dev.sh` 的 MySQL 为准)。
已安装本地 pre-push 钩子:推送前自动跑全量测试,失败阻止推送
(紧急绕过:`git push --no-verify``SKIP_TESTS=1 git push`)。
启用本地 pre-push 门禁(Ruff 格式检查 + pytest):
```bash
./scripts/install-git-hooks.sh
```
推送前自动跑全量测试,失败阻止推送(紧急绕过:`git push --no-verify`
`SKIP_TESTS=1 git push`)。
## 技术栈