From c90ebaa684832efb9d2087439a9b7ef4214f4594 Mon Sep 17 00:00:00 2001 From: Agate Berriot Date: Mon, 22 Aug 2022 11:13:01 +0200 Subject: [PATCH] dev: avoid connection to user database when running tests (#68312) --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2969f47..2973e33 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -64,7 +64,7 @@ def load_schema_db(schema): os.makedirs(bijoe_schema_dir) try: - with closing(psycopg2.connect('')) as conn: + with closing(psycopg2.connect(user=os.environ.get('USER'), dbname='postgres')) as conn: conn.set_isolation_level(0) with conn.cursor() as cursor: cursor.execute('CREATE DATABASE %s' % database_name) @@ -114,7 +114,7 @@ def load_schema_db(schema): d['tables'] = json.load(f) yield d finally: - with closing(psycopg2.connect('')) as conn: + with closing(psycopg2.connect(user=os.environ.get('USER'), dbname='postgres')) as conn: conn.set_isolation_level(0) with conn.cursor() as cursor: cursor.execute('DROP DATABASE IF EXISTS %s' % database_name) -- 2.37.2