Switch from MySQL-python to PyMySQL

As discussed in the Liberty Design Summit "Moving apps to Python 3"
cross-project workshop, the way forward in the near future is to
switch to the pure-python PyMySQL library as a default.

https://etherpad.openstack.org/p/liberty-cross-project-python3

Change-Id: I590c26523f4dc8d14c45e61bb89555486629b64d
This commit is contained in:
Jeremy Stanley 2015-05-20 01:03:59 +00:00
parent c541dff089
commit 650c811cdf
5 changed files with 9 additions and 10 deletions

View File

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

View File

@ -959,7 +959,7 @@ class SqlAlchemyDbApiNoDbTestCase(test.NoDBTestCase):
def test_get_regexp_op_for_database_mysql(self):
op = sqlalchemy_api._get_regexp_op_for_connection(
'mysql://root@localhost')
'mysql+pymysql://root@localhost')
self.assertEqual('REGEXP', op)
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):
uuid = uuidutils.generate_uuid()
db_mapping = get_db_mapping(uuid=uuid, name='test',
database_connection='mysql:///')
database_connection='mysql+pymysql:///')
create_in_db.return_value = db_mapping
mapping_obj = objects.CellMapping(self.context)
mapping_obj.uuid = uuid
mapping_obj.name = 'test'
mapping_obj.database_connection = 'mysql:///'
mapping_obj.database_connection = 'mysql+pymysql:///'
mapping_obj.create()
create_in_db.assert_called_once_with(self.context,
{'uuid': uuid,
'name': 'test',
'database_connection': 'mysql:///'})
'database_connection': 'mysql+pymysql:///'})
self.compare_obj(mapping_obj, db_mapping)
@mock.patch.object(cell_mapping.CellMapping, '_save_in_db')
def test_save(self, save_in_db):
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
mapping_obj = objects.CellMapping(self.context)
mapping_obj.uuid = uuid
mapping_obj.database_connection = 'mysql:///'
mapping_obj.database_connection = 'mysql+pymysql:///'
mapping_obj.save()
save_in_db.assert_called_once_with(self.context, uuid,
{'uuid': uuid,
'database_connection': 'mysql:///'})
'database_connection': 'mysql+pymysql:///'})
self.compare_obj(mapping_obj, db_mapping)
@mock.patch.object(cell_mapping.CellMapping, '_destroy_in_db')

View File

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

View File

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