Commit caf58da5 authored by Julien Muchembled's avatar Julien Muchembled

tests: do not setup MySQL db if only BTree will be used

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2806 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 39c61963
......@@ -238,6 +238,7 @@ class NEOCluster(object):
):
if not adapter:
adapter = 'MySQL'
self.adapter = adapter
self.zodb_storage_list = []
self.cleanup_on_delete = cleanup_on_delete
self.verbose = verbose
......@@ -324,12 +325,17 @@ class NEOCluster(object):
return MySQLdb.Connect(**connect_arg_dict)
def setupDB(self):
if self.adapter == 'MySQL':
sql_connection = self.__getSuperSQLConnection()
cursor = sql_connection.cursor()
for database in self.db_list:
cursor.execute('DROP DATABASE IF EXISTS `%s`' % (database, ))
cursor.execute('CREATE DATABASE `%s`' % (database, ))
cursor.execute('GRANT ALL ON `%s`.* TO "%s"@"localhost" '\
try:
cursor.execute('DROP DATABASE `%s`' % database)
except MySQLdb.OperationalError, (code, _):
if code != MySQLdb.constants.ER.DB_DROP_EXISTS:
raise
cursor.execute('CREATE DATABASE `%s`' % database)
cursor.execute('GRANT ALL ON `%s`.* TO "%s"@"localhost" '
'IDENTIFIED BY "%s"' % (database, self.db_user,
self.db_password))
cursor.close()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment