enable BDD tests for sqlite databases

The database must currently be created by hand and the name handed
in via -DAPI_TEST_DB='sqlite:...'.
This commit is contained in:
Sarah Hoffmann
2023-10-13 21:32:03 +02:00
parent 8216899a9a
commit d8dca2a3a9
18 changed files with 41 additions and 11 deletions

View File

@@ -86,7 +86,10 @@ class NominatimEnvironment:
be picked up by dotenv and creates a project directory with the
appropriate website scripts.
"""
dsn = 'pgsql:dbname={}'.format(dbname)
if dbname.startswith('sqlite:'):
dsn = 'sqlite:dbname={}'.format(dbname[7:])
else:
dsn = 'pgsql:dbname={}'.format(dbname)
if self.db_host:
dsn += ';host=' + self.db_host
if self.db_port:
@@ -197,6 +200,9 @@ class NominatimEnvironment:
"""
self.write_nominatim_config(self.api_test_db)
if self.api_test_db.startswith('sqlite:'):
return
if not self.api_db_done:
self.api_db_done = True