test: unpack (rows, count) tuple in sqlite scheduler integration tests#8749
Open
ashpreetbedi wants to merge 1 commit into
Open
test: unpack (rows, count) tuple in sqlite scheduler integration tests#8749ashpreetbedi wants to merge 1 commit into
ashpreetbedi wants to merge 1 commit into
Conversation
get_schedules and get_schedule_runs return Tuple[List[Dict], int] per the BaseDb contract (and as consumed by the schedules REST router), but 7 integration tests treated the return value as a plain list, failing with TypeError/AssertionError. Unpack the tuple and assert total_count where meaningful. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Fixes 7 failing tests in
libs/agno/tests/integration/db/sqlite/test_scheduler.py(TypeError: list indices must be integers or slices, not str/ wrong-length assertions).The tests treated the return value of
get_schedules/get_schedule_runsas a plain list, but theBaseDbcontract declares both as returningTuple[List[Dict], int](rows, total_count) — which is how the schedules REST router consumes them (schedules, total_count = await _db_call("get_schedules", ...)) and how the mongo scheduler unit tests already assert. The SQLite implementation follows the contract, so the tests were the wrong side.Changes (test-only, no library code touched):
(rows, total_count)tuple at all 7 call sitestotal_countwhere meaningful (e.g.limit=3over 5 runs now also assertstotal_count == 5; empty case assertstotal_count == 0)The failure is pre-existing on
mainand reproduces identically onfeat/v2.7(scheduler db code is identical on both branches); this fix makes all 23 tests in the file pass against both.Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)Duplicate and AI-Generated PR Check
Additional Notes
pytest libs/agno/tests/integration/db/sqlite/test_scheduler.py— 23 passed, run against bothmainandfeat/v2.7library code../scripts/validate.shreports 17 pre-existing mypy errors in unrelated files (gemini.py,pineconedb.py,jina.py, ...) that exist onmainwithout this change; ruff format/check pass clean.feat/v2.7, so this merges/cherry-picks cleanly there.🤖 Generated with Claude Code