Inherit from oslotest base

Oslotest base class should be used as the base for unit test classes.
In addtion the oslotest BaseTestCase inherits from testtools.testCase,
according to fixtures docs "testtools has it’s own implementation of
useFixture so there is no need to use fixtures.TestWithFixtures with
testtools.TestCase."

Co-Authored-By: moshe levi <moshele@mellanox.com>
Change-Id: I7296d59ee30230ec2de6d55649c9f57a33534435
This commit is contained in:
Edan David 2016-09-04 05:17:52 -04:00
parent 375661ee23
commit f9979c1228
3 changed files with 6 additions and 8 deletions

View File

@ -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

View File

@ -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):

View File

@ -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(