Add db configuration to modifying config
Move more tests over
This commit is contained in:
parent
d44aa8f566
commit
d9f7c07f42
10 changed files with 530 additions and 406 deletions
|
@ -321,7 +321,7 @@ def _db_from_url(url, db_kwargs, connect_timeout=DEFAULT_DB_CONNECT_TIMEOUT,
|
|||
return driver(parsed_url.database, **db_kwargs)
|
||||
|
||||
|
||||
def configure(config_object):
|
||||
def configure(config_object, testing=False):
|
||||
logger.debug('Configuring database')
|
||||
db_kwargs = dict(config_object['DB_CONNECTION_ARGS'])
|
||||
write_db_uri = config_object['DB_URI']
|
||||
|
@ -344,7 +344,7 @@ def configure(config_object):
|
|||
|
||||
@contextmanager
|
||||
def _ensure_under_transaction():
|
||||
if not config_object['TESTING']:
|
||||
if not testing and not config_object['TESTING']:
|
||||
if db.transaction_depth() == 0:
|
||||
raise Exception('Expected to be under a transaction')
|
||||
|
||||
|
|
Reference in a new issue