fix some test case wrongly skipped for mysql backend

https://review.openstack.org/#/c/235831/ enables all test cases for
ysql when PyMySQL is used as MySQL driver, but some test cases are
specified via run_with() decorator, which might expect engine is mysql
while actually we provide mysql+pymysql, so these test cases will be
wrongly skipped.

This patch maps mysql+pymysql to mysql to make sure there is an engine
handles it for such case.

Change-Id: I062d1d04b4b1511626a9b02f0249b5c93b5592b8
Closes-Bug: #1519211
This commit is contained in:
ZhiQiang Fan 2015-11-24 21:46:37 +08:00
parent 096e98d34d
commit 3549f782d1
1 changed files with 3 additions and 1 deletions

View File

@ -188,7 +188,6 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
DRIVER_MANAGERS = {
'mongodb': MongoDbManager,
'mysql': MySQLManager,
'mysql+pymysql': MySQLManager,
'postgresql': PgSQLManager,
'db2': MongoDbManager,
'sqlite': SQLiteManager,
@ -202,6 +201,9 @@ class TestBase(testscenarios.testcase.WithScenarios, test_base.BaseTestCase):
def setUp(self):
super(TestBase, self).setUp()
engine = urlparse.urlparse(self.db_url).scheme
# in case some drivers have additional specification, for example:
# PyMySQL will have scheme mysql+pymysql
engine = engine.split('+')[0]
# NOTE(Alexei_987) Shortcut to skip expensive db setUp
test_method = self._get_test_method()