fix(tests): 三渲二 fixture 补 flush 与积分账户 - #377
Merged
minorcell merged 1 commit intoAug 18, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Author
|
这个建议优先合,main 现在 30 项测试失败,任何人 rebase 上去都会看到红。根因是 #277 合入那次 CI 结论是 cancelled 而不是 success —— 没被真正验证过。 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
main上uv run pytest -q有 30 项失败,全在三渲二的两个测试文件。修两处 fixture 前置条件,不动被测代码。一、
test_render3d_asset_endpoints.py的apifixture 缺flush()。同一 session 里先
add(Project(id=1))再add(Character(project_id=1)),而Character.project_id有真外键。SQLAlchemy 不保证同一 session 内跨表的插入顺序,character 先落就是FOREIGN KEY constraint failed。补一次flush()把顺序钉死。二、
test_render3d_route_and_assets.py两个用例缺积分账户。它们走真实端点
POST /generation/action,而 #351 让该端点提交时预冻结积分,无账户返回{'code': 404, 'message': '积分账户不存在'}。用 conftest 已有的seed_credit_account补上。Closes #376
Test plan
uv run pytest -q→ 893 passed, 14 skipped(修前 30 failed)uv run pytest -q tests/test_render3d_asset_endpoints.py单跑 → 20 passed(这条路径正是暴露顺序问题的地方)uv run pytest -q tests/test_render3d_route_and_assets.py单跑 → 25 passeduv run ruff check .→ All checks passeduv run lint-imports→ 2 kept, 0 broken