dev: avoid connection to user database when running tests (#68312)
This commit is contained in:
parent
4b7981a951
commit
c90ebaa684
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue