From 667e31d0530aaf2140a105e6fbae6affd40eb1c6 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 28 Aug 2019 12:31:40 +0200 Subject: [PATCH] API - fix database connections error on tests --- fittrackee_api/fittrackee_api/tests/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fittrackee_api/fittrackee_api/tests/conftest.py b/fittrackee_api/fittrackee_api/tests/conftest.py index 493bd17d..95e3202e 100644 --- a/fittrackee_api/fittrackee_api/tests/conftest.py +++ b/fittrackee_api/fittrackee_api/tests/conftest.py @@ -19,6 +19,10 @@ def app(): yield app db.session.remove() db.drop_all() + # close unused idle connections => avoid the following error: + # FATAL: remaining connection slots are reserved for non-replication + # superuser connections + db.engine.dispose() return app @@ -31,6 +35,7 @@ def app_no_registration(): yield app db.session.remove() db.drop_all() + db.engine.dispose() return app