-
Notifications
You must be signed in to change notification settings - Fork 0
SQLite -> Postgres Test Migration #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| asyncio_default_fixture_loop_scope = session | ||
| asyncio_default_test_loop_scope = session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary for async session fixture shenanigans
| # Clean up: truncate all tables and reset sequences | ||
| async with test_engine.begin() as conn: | ||
| tables = [table.name for table in EntityBase.metadata.sorted_tables] | ||
| if tables: | ||
| # Disable foreign key checks, truncate, and reset sequences | ||
| await conn.execute(text("SET session_replication_role = 'replica';")) | ||
| for table in tables: | ||
| await conn.execute(text(f"TRUNCATE TABLE {table} RESTART IDENTITY CASCADE;")) | ||
| await conn.execute(text("SET session_replication_role = 'origin';")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Truncate instead of drop all tables so that tests don't take a million years
Test Results Summary302 tests +16 302 ✅ +16 12s ⏱️ +4s Results for commit 041b637. ± Comparison against base commit e23a979. This pull request removes 1 and adds 17 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
0c6a566 to
76f5754
Compare
76f5754 to
041b637
Compare
Fixed tests to use Postgres instead of sqlite
Changes:
Extras:
create_db.pyto see if the db already exists, so that expected behavior doesn't look like an errorget_parties_nearbyandget_parties_csvvalidate date format at middleware level with regexCloses #143