diff --git a/src/core/tests/runner.py b/src/core/tests/runner.py
index b9a10409f3a63533eeeb2b347a52a314955d8f02..c8588031dee1782e9a644fc587dea26ab37119c3 100644
--- a/src/core/tests/runner.py
+++ b/src/core/tests/runner.py
@@ -2,11 +2,18 @@ from types import MethodType
 from django.test.runner import DiscoverRunner
 from django.db import connections
 
+
 def prepare_database(self):
     self.connect()
+
+    try:
+        username = self.connection.get_dsn_parameters()['user']
+    except AttributeError:  # psycopg has moved this method
+        username = self.connection.info.get_parameters()['user']
+
     self.connection.cursor().execute(f"""
-    CREATE SCHEMA rc3schema AUTHORIZATION {self.connection.get_dsn_parameters()["user"]};
-    GRANT ALL ON SCHEMA rc3schema TO {self.connection.get_dsn_parameters()["user"]};
+    CREATE SCHEMA rc3schema AUTHORIZATION {username};
+    GRANT ALL ON SCHEMA rc3schema TO {username};
     """)