test(dev_tools): refractor-test render step mock is a dead mock #169
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
autonomous
bug
enhancement
feature
in-queue
performance
security
size:M
size:S
tech-debt
tests
todo
type:feature
type:stability
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#169
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Surfaced by the pr-reviewer agent during review of PR #168
(fix/refractor-test-unified-cards-lookup).
Problem
tests/test_dev_tools.py::TestRefractorTestExecute::test_successful_batter_flowpatches
db_getas a way of stubbing the card-render step, but theactual render call in
cogs/dev_tools.pyusesaiohttp.ClientSessiondirectly, not
db_get. So the test'smock_get.return_valuefor therender step is never exercised — the test passes because the aiohttp
call raises and hits the non-fatal
exceptbranch that records awarning ("⚠️ Card render failed (non-fatal): ...") instead of the
happy-path "✅ Card rendered + S3 upload triggered".
This means the happy-path render assertion is silently skipped, and a
future regression that broke the render chain would not be caught by
this test.
Fix
Patch
aiohttp.ClientSession(or the full render call path) intest_successful_batter_flowso the test exercises the real 200-OKcode path, then assert the "✅ Card rendered + S3 upload triggered"
line appears in the results.
Notes
PR #168 is scoped to the card-lookup fix; this cleanup belongs in
a separate PR.
modes of the refractor chain; only the happy-path render branch
is unexercised.
PR #170 fixes this. Replaced the dead
db_getmock with a properaiohttp.ClientSessionmock (explicitMagicMockwith__aenter__/__aexit__sosess.get(url)returns an async context manager, not a coroutine). Render step now exercises the 200-OK path and asserts"✅ Card rendered + S3 upload triggered"in results. 14/14 tests pass.