Skip to content

fix(tests): 三渲二 fixture 补 flush 与积分账户 - #377

Merged
minorcell merged 1 commit into
1024XEngineer:mainfrom
johnnyzhang-eng:fix/render3d-test-fixture-fk
Aug 18, 2026
Merged

fix(tests): 三渲二 fixture 补 flush 与积分账户#377
minorcell merged 1 commit into
1024XEngineer:mainfrom
johnnyzhang-eng:fix/render3d-test-fixture-fk

Conversation

@johnnyzhang-eng

Copy link
Copy Markdown
Contributor

Summary

mainuv run pytest -q 有 30 项失败,全在三渲二的两个测试文件。修两处 fixture 前置条件,不动被测代码。

一、test_render3d_asset_endpoints.pyapi fixture 缺 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 -q893 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 passed
  • uv run ruff check . → All checks passed
  • uv run lint-imports → 2 kept, 0 broken

@vercel

vercel Bot commented Aug 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
windup Ignored Ignored Preview Aug 18, 2026 6:06am

@johnnyzhang-eng

Copy link
Copy Markdown
Contributor Author

这个建议优先合,main 现在 30 项测试失败,任何人 rebase 上去都会看到红。根因是 #277 合入那次 CI 结论是 cancelled 而不是 success —— 没被真正验证过。

@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审阅了本 PR 的完整固定提交范围,重点核对了两个测试 fixture 的数据库前置条件:flush() 确保项目先于带外键的角色写入;两个真实生成端点用例在冻结积分前创建用户积分账户。改动与 #376 描述的两类失败原因一致,未发现可报告的正确性、回归或可维护性问题。

验证:git diff --check 通过;当前运行环境没有安装 uvpytest,因此无法在本地重跑 PR 描述中的测试命令。

@minorcell minorcell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@minorcell
minorcell merged commit 28d2c93 into 1024XEngineer:main Aug 18, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

main 上三渲二测试 30 项失败:fixture 外键顺序与积分账户前置缺失

2 participants