Skip to content

test: unpack (rows, count) tuple in sqlite scheduler integration tests#8749

Open
ashpreetbedi wants to merge 1 commit into
mainfrom
claude/xenodochial-jackson-2478b5
Open

test: unpack (rows, count) tuple in sqlite scheduler integration tests#8749
ashpreetbedi wants to merge 1 commit into
mainfrom
claude/xenodochial-jackson-2478b5

Conversation

@ashpreetbedi

Copy link
Copy Markdown
Contributor

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_runs as a plain list, but the BaseDb contract declares both as returning Tuple[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):

  • Unpack the (rows, total_count) tuple at all 7 call sites
  • Assert total_count where meaningful (e.g. limit=3 over 5 runs now also asserts total_count == 5; empty case asserts total_count == 0)

The failure is pre-existing on main and reproduces identically on feat/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

  • Bug fix
  • New feature
  • Breaking change
  • Improvement
  • Model update
  • Other:

Checklist

  • Code complies with style guidelines
  • Ran format/validation scripts (./scripts/format.sh and ./scripts/validate.sh)
  • Self-review completed
  • Documentation updated (comments, docstrings) — N/A, test-only change
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable) — N/A
  • Tested in clean environment
  • Tests added/updated (if applicable)

Duplicate and AI-Generated PR Check

  • I have searched existing open pull requests and confirmed that no other PR already addresses this issue
  • If a similar PR exists, I have explained below why this PR is a better approach
  • Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.)

Additional Notes

  • Verification: pytest libs/agno/tests/integration/db/sqlite/test_scheduler.py — 23 passed, run against both main and feat/v2.7 library code.
  • ./scripts/validate.sh reports 17 pre-existing mypy errors in unrelated files (gemini.py, pineconedb.py, jina.py, ...) that exist on main without this change; ruff format/check pass clean.
  • The test file is identical on feat/v2.7, so this merges/cherry-picks cleanly there.

🤖 Generated with Claude Code

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>
@ashpreetbedi ashpreetbedi requested a review from a team as a code owner July 4, 2026 20:24
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.

1 participant