test: clean worker test DB before each test to prevent flakiness
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,11 @@ import pytest
|
||||
def conn():
|
||||
dsn = os.environ["DATABASE_URL"]
|
||||
connection = psycopg.connect(dsn)
|
||||
# Clean up any pre-existing rows before the test runs (Job cascades from Request).
|
||||
with connection.cursor() as cur:
|
||||
cur.execute('DELETE FROM "Job"')
|
||||
cur.execute('DELETE FROM "Request"')
|
||||
connection.commit()
|
||||
yield connection
|
||||
# Clean up rows created during the test (Job cascades from Request).
|
||||
with connection.cursor() as cur:
|
||||
|
||||
Reference in New Issue
Block a user