diff --git a/neutron/tests/common/base.py b/neutron/tests/common/base.py index d1541a63901..8c89f9be76e 100644 --- a/neutron/tests/common/base.py +++ b/neutron/tests/common/base.py @@ -110,5 +110,17 @@ class MySQLTestCase(test_base.DbTestCase): """Base test class for MySQL tests. Enforce the supported driver, which is PyMySQL. + If the MySQL db is unavailable then this test is skipped, unless + OS_FAIL_ON_MISSING_DEPS is enabled. """ FIXTURE = PyMySQLFixture + SKIP_ON_UNAVAILABLE_DB = not base.bool_from_env('OS_FAIL_ON_MISSING_DEPS') + + +class PostgreSQLTestCase(test_base.PostgreSQLOpportunisticTestCase): + """Base test class for PostgreSQL tests. + + If the PostgreSQL db is unavailable then this test is skipped, unless + OS_FAIL_ON_MISSING_DEPS is enabled. + """ + SKIP_ON_UNAVAILABLE_DB = not base.bool_from_env('OS_FAIL_ON_MISSING_DEPS') diff --git a/neutron/tests/functional/db/test_ipam.py b/neutron/tests/functional/db/test_ipam.py index 1eb7e58d5b2..a10e9e288a1 100644 --- a/neutron/tests/functional/db/test_ipam.py +++ b/neutron/tests/functional/db/test_ipam.py @@ -15,7 +15,6 @@ from oslo_config import cfg from oslo_db.sqlalchemy import session -from oslo_db.sqlalchemy import test_base import testtools from neutron.api.v2 import attributes @@ -213,7 +212,7 @@ class TestIpamMySql(common_base.MySQLTestCase, base.BaseTestCase, self.configure_test() -class TestIpamPsql(test_base.PostgreSQLOpportunisticTestCase, +class TestIpamPsql(common_base.PostgreSQLTestCase, base.BaseTestCase, IpamTestCase): def setUp(self): diff --git a/neutron/tests/functional/db/test_migrations.py b/neutron/tests/functional/db/test_migrations.py index a7a9b386890..ad3fd859534 100644 --- a/neutron/tests/functional/db/test_migrations.py +++ b/neutron/tests/functional/db/test_migrations.py @@ -214,7 +214,7 @@ class TestModelsMigrationsMysql(_TestModelsMigrations, class TestModelsMigrationsPsql(_TestModelsMigrations, - test_base.PostgreSQLOpportunisticTestCase): + base.PostgreSQLTestCase): pass