def rebuild_all_dbs(Session):
 db_read_url_parts = cli.parse_db_config('ckan.datastore.write_url')
 db_ckan_url_parts = cli.parse_db_config('sqlalchemy.url')
 same_db = (db_read_url_parts['db_name'] == db_ckan_url_parts['db_name'])
 if same_db:
  model.repo.tables_created_and_initialised = False
 clear_db(Session)
 model.repo.rebuild_db()

def rebuild_all_dbs ( Session ) : db_read_url_parts = cli . parse_db_config ( 'ckan.datastore.write_url' ) db_ckan_url_parts = cli . parse_db_config ( 'sqlalchemy.url' ) same_db = ( db_read_url_parts [ 'db_name' ] == db_ckan_url_parts [ 'db_name' ] ) if same_db : model . repo . tables_created_and_initialised = False clear_db ( Session ) model . repo . rebuild_db ( )
if the tests are running on the same db .