tests: write a site-options.cfg instead of overriding has_site_option
This commit is contained in:
parent
ac8770e7ae
commit
7ba6aa59f9
|
@ -64,13 +64,15 @@ def create_temporary_pub(sql_mode=False):
|
|||
if os.path.exists(pub.app_dir):
|
||||
pub.cfg = {}
|
||||
if sql_mode:
|
||||
pub.has_site_option = lambda x: True
|
||||
pub.cfg['postgresql'] = {'database': known_elements.sql_db_name, 'user': os.environ['USER']}
|
||||
pub.write_cfg()
|
||||
return pub
|
||||
|
||||
os.mkdir(pub.app_dir)
|
||||
if sql_mode:
|
||||
fd = file(os.path.join(pub.app_dir, 'site-options.cfg'), 'w')
|
||||
fd.write('[options]\npostgresql = true\n')
|
||||
fd.close()
|
||||
conn = psycopg2.connect(user=os.environ['USER'])
|
||||
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
|
||||
cur = conn.cursor()
|
||||
|
|
Loading…
Reference in New Issue