Skip to content

Commit 44a395f

Browse files
committed
Improve test database connection handling
- Add engine.dispose() calls to properly close connections - Add debug logging for engine URL in test_engine fixture - Ensure clean connection management between test setup and teardown
1 parent 25f9776 commit 44a395f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sqlalchemy_singlestoredb/tests/conftest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,13 @@ def test_database(base_connection_url: str) -> Generator[str, None, None]:
235235
else:
236236
print(f'Using existing database from connection URL: {db_name}')
237237

238+
engine.dispose()
239+
238240
# Yield the database name for all tests to use
239241
yield db_name
240242

243+
engine = create_engine(db_connection_url)
244+
241245
# Cleanup: Drop the test database at the end of the session
242246
if not has_database:
243247
print(f'Cleaning up shared test database: {db_name}')
@@ -264,6 +268,7 @@ def test_engine(
264268
else:
265269
test_url = f'{base_connection_url}/{test_database}'
266270

271+
print(f'Using engine URL: {test_url}')
267272
engine = create_engine(test_url)
268273

269274
yield engine

0 commit comments

Comments
 (0)