Back to articles
83k tokens to fix a few tests!? No thanks

83k tokens to fix a few tests!? No thanks

via Dev.to PythonChris Kilner

Claude burned 83,000 tokens fixing test failures after a refactor — raw pytest output, coverage noise, ruff warnings, all re-fed every loop. It worked. But it was absurdly expensive. The problem isn’t the model — it’s the context. So I made cq ( python-code-quality on PyPI) It runs 10+ quality tools and surfaces exactly one thing at a time. Minimal context Instead of dumping everything into the prompt, cq : runs tools in priority order stops at the first failure emits a single, focused fix request > cq check . -o llm ` src/myproject/utils.py:21 ` — ** F841 ** : Local variable ` unused_variable ` is assigned to but never used 18: min_dist = float ( "inf" ) 19: nearest_city = None 20: for city in cities: 21: unused_variable = 67 22: dist = calc_dist ( current_city, city ) Please fix only this issue. After fixing, run ` cq check . -o llm ` to verify. That’s it. No test logs, no coverage spam, no unrelated warnings. If the error looks like a caller / callee mismatch, we fetch the callee si

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
4 views

Related Articles