From 33b038ce6f0e3d55241763eb4311d9ea19313c99 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 19 Dec 2020 17:55:46 +0100 Subject: [PATCH] tests: always create the config file There is also one database test that uses the API functions. --- test/bdd/environment.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/test/bdd/environment.py b/test/bdd/environment.py index ce556931..8847011a 100644 --- a/test/bdd/environment.py +++ b/test/bdd/environment.py @@ -73,18 +73,28 @@ class NominatimEnvironment(object): return fn def write_nominatim_config(self, dbname): - self.test_env = os.environ - self.test_env['NOMINATIM_DATABASE_DSN'] = 'pgsql:dbname={}{}{}{}{}'.format( + dsn = 'pgsql:dbname={}{}{}{}{}'.format( dbname, (';host=' + self.db_host) if self.db_host else '', (';port=' + self.db_port) if self.db_port else '', (';user=' + self.db_user) if self.db_user else '', (';password=' + self.db_pass) if self.db_pass else '' ) + self.test_env = os.environ + self.test_env['NOMINATIM_DATABASE_DSN'] = dsn self.test_env['NOMINATIM_FLATNODE_FILE'] = '' self.test_env['NOMINATIM_IMPORT_STYLE'] = 'full' self.test_env['NOMINATIM_USE_US_TIGER_DATA'] = 'yes' + f = open(self.local_settings_file, 'w') + # https://secure.php.net/manual/en/ref.pdo-pgsql.connection.php + f.write("