Skip to content

Commit 223a64c

Browse files
committed
test: Fix FATAL: sorry, too many clients already
Within `BasePostgresSDKTests`, new database connections via SQLAlchemy haven't been closed, and started filling up the connection pool, eventually saturating it.
1 parent 8ec2a15 commit 223a64c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

target_postgres/tests/test_sdk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class BasePostgresSDKTests:
6161
@pytest.fixture()
6262
def connection(self, runner):
6363
engine = create_engine(runner)
64-
return engine.connect()
64+
with engine.connect() as connection:
65+
yield connection
6566

6667

6768
SDKTests = get_target_test_class(

0 commit comments

Comments
 (0)