Added Some Tests#16
Conversation
📝 WalkthroughWalkthroughThis PR expands test infrastructure and coverage: FakePool gains commit/rollback hooks and seeding helpers; multiple new and extended test modules are added to exercise DB init, health flags, versioning, PDF extraction, message-queue retries/throttling, model parsing, diffing, sources, scout helpers, and storage edge cases. ChangesTest infra + coverage expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/test_db.py (1)
62-65: ⚡ Quick winAdd a guard that
commit()is not called on DDL failure.Line 65 validates connection return, but without asserting
commitwas skipped, a regression in error handling could still pass this test.Suggested test tightening
def test_init_db_putconn_even_when_execute_fails(): @@ with pytest.raises(RuntimeError, match="DDL failed"): init_db(pool) + conn.commit.assert_not_called() pool.putconn.assert_called_once_with(conn)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/test_db.py` around lines 62 - 65, The test should also assert that no commit was performed when init_db(pool) raises a RuntimeError; after calling init_db(pool) within pytest.raises and before/after pool.putconn.assert_called_once_with(conn), add an assertion that conn.commit was not called (use conn.commit.assert_not_called()) so the test verifies commit is skipped on DDL failure (referencing init_db, conn, and pool.putconn.assert_called_once_with(conn)).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/test_db.py`:
- Around line 62-65: The test should also assert that no commit was performed
when init_db(pool) raises a RuntimeError; after calling init_db(pool) within
pytest.raises and before/after pool.putconn.assert_called_once_with(conn), add
an assertion that conn.commit was not called (use
conn.commit.assert_not_called()) so the test verifies commit is skipped on DDL
failure (referencing init_db, conn, and
pool.putconn.assert_called_once_with(conn)).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 747c753e-c638-41b9-b3d7-26f3b69f3547
📒 Files selected for processing (4)
tests/conftest.pytests/test_db.pytests/test_scout_extra.pytests/test_storage.py
✅ Files skipped from review due to trivial changes (1)
- tests/test_scout_extra.py
🚧 Files skipped from review as they are similar to previous changes (2)
- tests/test_storage.py
- tests/conftest.py
Summary
added/updated some test files
Test plan
./run check(ormake check)pre-commit run --all-filesRelated issues
close #14
Summary by CodeRabbit
Tests
Chores