def create_test_db():
 from inbox.config import config
 database_hosts = config.get_required('DATABASE_HOSTS')
 schemas = [(shard['SCHEMA_NAME'], host['HOSTNAME']) for host in database_hosts for shard in host['SHARDS']]
 assert all([('test' in s) for (s, h) in schemas])
 for (name, host) in schemas:
  cmd = 'DROP DATABASE IF EXISTS {name}; CREATE DATABASE IF NOT EXISTS {name} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci'.format(name=name)
  subprocess.check_call('mysql -h {} -uinboxtest -pinboxtest -e "{}"'.format(host, cmd), shell=True)

def create_test_db ( ) : from inbox . config import config database_hosts = config . get_required ( 'DATABASE_HOSTS' ) schemas = [ ( shard [ 'SCHEMA_NAME' ] , host [ 'HOSTNAME' ] ) for host in database_hosts for shard in host [ 'SHARDS' ] ] assert all ( [ ( 'test' in s ) for ( s , h ) in schemas ] ) for ( name , host ) in schemas : cmd = 'DROP DATABASE IF EXISTS {name}; CREATE DATABASE IF NOT EXISTS {name} DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci' . format ( name = name ) subprocess . check_call ( 'mysql -h {} -uinboxtest -pinboxtest -e "{}"' . format ( host , cmd ) , shell = True )
creates new .