Merge "Switch from MySQL-python to PyMySQL"

This commit is contained in:
Jenkins 2015-07-15 15:53:35 +00:00 committed by Gerrit Code Review
commit 275c9ace5c
5 changed files with 9 additions and 10 deletions

View File

@ -30,7 +30,7 @@ class CellMappingTestCase(test.NoDBTestCase):
sample_mapping = {'uuid': '', sample_mapping = {'uuid': '',
'name': 'fake-cell', 'name': 'fake-cell',
'transport_url': 'rabbit:///', 'transport_url': 'rabbit:///',
'database_connection': 'mysql:///'} 'database_connection': 'mysql+pymysql:///'}
def _create_mapping(self, **kwargs): def _create_mapping(self, **kwargs):
args = self.sample_mapping.copy() args = self.sample_mapping.copy()

View File

@ -956,7 +956,7 @@ class SqlAlchemyDbApiNoDbTestCase(test.NoDBTestCase):
def test_get_regexp_op_for_database_mysql(self): def test_get_regexp_op_for_database_mysql(self):
op = sqlalchemy_api._get_regexp_op_for_connection( op = sqlalchemy_api._get_regexp_op_for_connection(
'mysql://root@localhost') 'mysql+pymysql://root@localhost')
self.assertEqual('REGEXP', op) self.assertEqual('REGEXP', op)
def test_get_regexp_op_for_database_postgresql(self): def test_get_regexp_op_for_database_postgresql(self):

View File

@ -59,33 +59,33 @@ class _TestCellMappingObject(object):
def test_create(self, create_in_db): def test_create(self, create_in_db):
uuid = uuidutils.generate_uuid() uuid = uuidutils.generate_uuid()
db_mapping = get_db_mapping(uuid=uuid, name='test', db_mapping = get_db_mapping(uuid=uuid, name='test',
database_connection='mysql:///') database_connection='mysql+pymysql:///')
create_in_db.return_value = db_mapping create_in_db.return_value = db_mapping
mapping_obj = objects.CellMapping(self.context) mapping_obj = objects.CellMapping(self.context)
mapping_obj.uuid = uuid mapping_obj.uuid = uuid
mapping_obj.name = 'test' mapping_obj.name = 'test'
mapping_obj.database_connection = 'mysql:///' mapping_obj.database_connection = 'mysql+pymysql:///'
mapping_obj.create() mapping_obj.create()
create_in_db.assert_called_once_with(self.context, create_in_db.assert_called_once_with(self.context,
{'uuid': uuid, {'uuid': uuid,
'name': 'test', 'name': 'test',
'database_connection': 'mysql:///'}) 'database_connection': 'mysql+pymysql:///'})
self.compare_obj(mapping_obj, db_mapping) self.compare_obj(mapping_obj, db_mapping)
@mock.patch.object(cell_mapping.CellMapping, '_save_in_db') @mock.patch.object(cell_mapping.CellMapping, '_save_in_db')
def test_save(self, save_in_db): def test_save(self, save_in_db):
uuid = uuidutils.generate_uuid() uuid = uuidutils.generate_uuid()
db_mapping = get_db_mapping(database_connection='mysql:///') db_mapping = get_db_mapping(database_connection='mysql+pymysql:///')
save_in_db.return_value = db_mapping save_in_db.return_value = db_mapping
mapping_obj = objects.CellMapping(self.context) mapping_obj = objects.CellMapping(self.context)
mapping_obj.uuid = uuid mapping_obj.uuid = uuid
mapping_obj.database_connection = 'mysql:///' mapping_obj.database_connection = 'mysql+pymysql:///'
mapping_obj.save() mapping_obj.save()
save_in_db.assert_called_once_with(self.context, uuid, save_in_db.assert_called_once_with(self.context, uuid,
{'uuid': uuid, {'uuid': uuid,
'database_connection': 'mysql:///'}) 'database_connection': 'mysql+pymysql:///'})
self.compare_obj(mapping_obj, db_mapping) self.compare_obj(mapping_obj, db_mapping)
@mock.patch.object(cell_mapping.CellMapping, '_destroy_in_db') @mock.patch.object(cell_mapping.CellMapping, '_destroy_in_db')

View File

@ -8,7 +8,6 @@ discover
fixtures>=1.3.1 fixtures>=1.3.1
mock>=1.0 mock>=1.0
mox3>=0.7.0 mox3>=0.7.0
MySQL-python;python_version=='2.7'
psycopg2 psycopg2
PyMySQL>=0.6.2 # MIT License PyMySQL>=0.6.2 # MIT License
python-barbicanclient>=3.0.1 python-barbicanclient>=3.0.1

View File

@ -32,7 +32,7 @@ Run like:
MYSQL: MYSQL:
./tools/db/schema_diff.py mysql://root@localhost \ ./tools/db/schema_diff.py mysql+pymysql://root@localhost \
master:latest my_branch:82 master:latest my_branch:82
POSTGRESQL: POSTGRESQL: