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): ...@@ -238,6 +238,7 @@ class NEOCluster(object):
): ):
if not adapter: if not adapter:
adapter = 'MySQL' adapter = 'MySQL'
self.adapter = adapter
self.zodb_storage_list = [] self.zodb_storage_list = []
self.cleanup_on_delete = cleanup_on_delete self.cleanup_on_delete = cleanup_on_delete
self.verbose = verbose self.verbose = verbose
...@@ -324,12 +325,17 @@ class NEOCluster(object): ...@@ -324,12 +325,17 @@ class NEOCluster(object):
return MySQLdb.Connect(**connect_arg_dict) return MySQLdb.Connect(**connect_arg_dict)
def setupDB(self): def setupDB(self):
if self.adapter == 'MySQL':
sql_connection = self.__getSuperSQLConnection() sql_connection = self.__getSuperSQLConnection()
cursor = sql_connection.cursor() cursor = sql_connection.cursor()
for database in self.db_list: for database in self.db_list:
cursor.execute('DROP DATABASE IF EXISTS `%s`' % (database, )) try:
cursor.execute('CREATE DATABASE `%s`' % (database, )) cursor.execute('DROP DATABASE `%s`' % database)
cursor.execute('GRANT ALL ON `%s`.* TO "%s"@"localhost" '\ 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, 'IDENTIFIED BY "%s"' % (database, self.db_user,
self.db_password)) self.db_password))
cursor.close() 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