[Stack 10/17] Fix test DB connection: use DATABASE_URL with dotenv#2517
Open
jucor wants to merge 1 commit intospr/edge/ea747196from
Open
[Stack 10/17] Fix test DB connection: use DATABASE_URL with dotenv#2517jucor wants to merge 1 commit intospr/edge/ea747196from
jucor wants to merge 1 commit intospr/edge/ea747196from
Conversation
This was referenced Mar 30, 2026
Open
Open
8dc9313 to
abee548
Compare
07c707d to
e046e08
Compare
## Summary - **Absorbed PR #2434** (DB connect_timeout): adds `connect_timeout=5` to all DB connections so tests fail fast instead of hanging when Postgres is unavailable. Reverts timeout from production code (a 5s timeout could break real deployments), keeping it only in test code. - Adds `require_dynamodb()` and `require_s3()` helpers to conftest that probe services with short timeouts and `pytest.fail()` immediately — applied to all tests that previously hung when Docker services were down. - Adds `pytest-timestamper` for per-test timing visibility. - Fixes `test_postgres_real_data.py` to use `DATABASE_URL` (consistent with all other delphi Python code) via `python-dotenv`. Refs #2442 ## Test plan - [x] `test_conversation_from_postgres` passes - [x] `test_pakistan_conversation_batch` passes (9 min, 400K votes) - [x] Full delphi test suite: 294 passed, no regressions 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Squashed commits - Add connect_timeout to all DB connections, fail tests on DB unavailable - Fail tests fast when services are unavailable instead of hanging - Fix conftest docstring: require_dynamodb/require_s3, not require_service - Skip (not fail) test_minio_access when MinIO is unavailable - Fail test_conversation_from_postgres fast when DynamoDB is unavailable - Fail test_run_math_pipeline_e2e fast when DynamoDB is unavailable - Add pytest-timestamper and fix test_501 hang on Docker unavailable - Defer heavy import in test_umap_narrative_pipeline (defensive) - Address Copilot review: fix timing_stats_compared None bug, fix return type - Fix test DB connection: use DATABASE_URL with dotenv - Fix CI: use find_dotenv() and fall back to DATABASE_* vars - Restore get_or_compute_conversation fixture and test reordering hook - Remove dead xdist_group markers from make_dataset_params commit-id:b9062b50
abee548 to
517908a
Compare
Delphi Coverage Report
|
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
connect_timeout=5to all DB connections so tests fail fast instead of hanging when Postgres is unavailable. Reverts timeout from production code (a 5s timeout could break real deployments), keeping it only in test code.require_dynamodb()andrequire_s3()helpers to conftest that probe services with short timeouts andpytest.fail()immediately — applied to all tests that previously hung when Docker services were down.pytest-timestamperfor per-test timing visibility.test_postgres_real_data.pyto useDATABASE_URL(consistent with all other delphi Python code) viapython-dotenv.Refs #2442
Test plan
test_conversation_from_postgrespassestest_pakistan_conversation_batchpasses (9 min, 400K votes)🤖 Generated with Claude Code
Squashed commits
commit-id:b9062b50
Stack: