diff --git a/ironic_inspector/test/base.py b/ironic_inspector/test/base.py index a6c77e1b5..b8d2d84f9 100644 --- a/ironic_inspector/test/base.py +++ b/ironic_inspector/test/base.py @@ -12,7 +12,6 @@ # limitations under the License. -import fixtures import futurist import mock from oslo_concurrency import lockutils @@ -21,6 +20,7 @@ from oslo_config import fixture as config_fixture from oslo_log import log from oslo_utils import units from oslo_utils import uuidutils +from oslotest import base as test_base from ironic_inspector.common import i18n # Import configuration options @@ -33,7 +33,7 @@ from ironic_inspector import utils CONF = cfg.CONF -class BaseTest(fixtures.TestWithFixtures): +class BaseTest(test_base.BaseTestCase): IS_FUNCTIONAL = False diff --git a/ironic_inspector/test/unit/test_main.py b/ironic_inspector/test/unit/test_main.py index 0906e03c3..6fd4c3c53 100644 --- a/ironic_inspector/test/unit/test_main.py +++ b/ironic_inspector/test/unit/test_main.py @@ -584,6 +584,7 @@ class TestInit(test_base.BaseTest): @mock.patch.object(firewall, 'clean_up', lambda: None) def tearDown(self): self.service.shutdown() + super(TestInit, self).tearDown() def test_ok(self, mock_node_cache, mock_get_client, mock_auth, mock_firewall): diff --git a/ironic_inspector/test/unit/test_process.py b/ironic_inspector/test/unit/test_process.py index ee726e965..8a525f6c2 100644 --- a/ironic_inspector/test/unit/test_process.py +++ b/ironic_inspector/test/unit/test_process.py @@ -563,12 +563,9 @@ class TestReapply(BaseTest): @prepare_mocks def test_locking_failed(self, pop_mock, reapply_mock): pop_mock.return_value.acquire_lock.return_value = False - exc = utils.Error('Node locked, please, try again later') - - with self.assertRaises(type(exc)) as cm: - process.reapply(self.uuid) - - self.assertEqual(str(exc), str(cm.exception)) + self.assertRaisesRegex(utils.Error, + 'Node locked, please, try again later', + process.reapply, self.uuid) pop_mock.assert_called_once_with(self.uuid, locked=False) pop_mock.return_value.acquire_lock.assert_called_once_with(