Have unit tests all derive from our base unit test class
Have our unit tests derive from the base unit test class in ironic_python_agent/tests/unit/base: IronicAgentTest This is so if we add additional global common features to our base test class, all of our tests will get those common features. Change-Id: I5188112f06dcfda4f5b0fd41fa9b9dd270cde8d7
This commit is contained in:
parent
ce32efc82b
commit
265a072b72
@ -13,11 +13,11 @@
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
from stevedore import extension
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import base
|
||||
from ironic_python_agent.tests.unit import base as test_base
|
||||
|
||||
|
||||
def _fake_validator(ext, **kwargs):
|
||||
@ -60,7 +60,7 @@ class FakeAgent(base.ExecuteCommandMixin):
|
||||
FakeExtension())])
|
||||
|
||||
|
||||
class TestExecuteCommandMixin(test_base.BaseTestCase):
|
||||
class TestExecuteCommandMixin(test_base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestExecuteCommandMixin, self).setUp()
|
||||
self.agent = FakeAgent()
|
||||
@ -117,7 +117,7 @@ class TestExecuteCommandMixin(test_base.BaseTestCase):
|
||||
self.assertEqual(exc, result.command_error)
|
||||
|
||||
|
||||
class TestExtensionDecorators(test_base.BaseTestCase):
|
||||
class TestExtensionDecorators(test_base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestExtensionDecorators, self).setUp()
|
||||
self.agent = FakeAgent()
|
||||
|
@ -13,14 +13,14 @@
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import clean
|
||||
from ironic_python_agent.tests.unit import base
|
||||
|
||||
|
||||
@mock.patch('ironic_python_agent.hardware.cache_node', autospec=True)
|
||||
class TestCleanExtension(test_base.BaseTestCase):
|
||||
class TestCleanExtension(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestCleanExtension, self).setUp()
|
||||
self.agent_extension = clean.CleanExtension()
|
||||
@ -245,7 +245,7 @@ class TestCleanExtension(test_base.BaseTestCase):
|
||||
|
||||
@mock.patch('ironic_python_agent.hardware.dispatch_to_all_managers',
|
||||
autospec=True)
|
||||
class TestCleanVersion(test_base.BaseTestCase):
|
||||
class TestCleanVersion(base.IronicAgentTest):
|
||||
version = {'generic': '1', 'specific': '1'}
|
||||
|
||||
def test__get_current_clean_version(self, mock_dispatch):
|
||||
|
@ -15,13 +15,13 @@
|
||||
import time
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
from stevedore import enabled
|
||||
from stevedore import extension
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import base
|
||||
from ironic_python_agent.extensions import flow
|
||||
from ironic_python_agent.tests.unit import base as test_base
|
||||
|
||||
|
||||
FLOW_INFO = [
|
||||
@ -45,7 +45,7 @@ class FakeExtension(base.BaseAgentExtension):
|
||||
time.sleep(sleep_info['time'])
|
||||
|
||||
|
||||
class TestFlowExtension(test_base.BaseTestCase):
|
||||
class TestFlowExtension(test_base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestFlowExtension, self).setUp()
|
||||
self.agent_extension = flow.FlowExtension()
|
||||
|
@ -19,12 +19,12 @@ import tempfile
|
||||
|
||||
import mock
|
||||
from oslo_concurrency import processutils
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import image
|
||||
from ironic_python_agent.extensions import iscsi
|
||||
from ironic_python_agent import hardware
|
||||
from ironic_python_agent.tests.unit import base
|
||||
from ironic_python_agent import utils
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ from ironic_python_agent import utils
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch.object(tempfile, 'mkdtemp', lambda *_: '/tmp/fake-dir')
|
||||
@mock.patch.object(shutil, 'rmtree', lambda *_: None)
|
||||
class TestImageExtension(test_base.BaseTestCase):
|
||||
class TestImageExtension(base.IronicAgentTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestImageExtension, self).setUp()
|
||||
|
@ -17,11 +17,11 @@ import mock
|
||||
|
||||
from ironic_lib import disk_utils
|
||||
from oslo_concurrency import processutils
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import iscsi
|
||||
from ironic_python_agent import hardware
|
||||
from ironic_python_agent.tests.unit import base
|
||||
from ironic_python_agent import utils
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class FakeAgent(object):
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@mock.patch.object(iscsi.rtslib_fb, 'RTSRoot',
|
||||
mock.Mock(side_effect=iscsi.rtslib_fb.RTSLibError()))
|
||||
class TestISCSIExtensionTgt(test_base.BaseTestCase):
|
||||
class TestISCSIExtensionTgt(base.IronicAgentTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestISCSIExtensionTgt, self).setUp()
|
||||
@ -151,7 +151,7 @@ _ORIG_UTILS = iscsi.rtslib_fb.utils
|
||||
@mock.patch.object(hardware, 'dispatch_to_managers', autospec=True)
|
||||
# Don't mock the utils module, as it contains exceptions
|
||||
@mock.patch.object(iscsi, 'rtslib_fb', utils=_ORIG_UTILS, autospec=True)
|
||||
class TestISCSIExtensionLIO(test_base.BaseTestCase):
|
||||
class TestISCSIExtensionLIO(base.IronicAgentTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestISCSIExtensionLIO, self).setUp()
|
||||
@ -283,7 +283,7 @@ class TestISCSIExtensionLIO(test_base.BaseTestCase):
|
||||
|
||||
|
||||
@mock.patch.object(iscsi.rtslib_fb, 'RTSRoot', autospec=True)
|
||||
class TestISCSIExtensionCleanUp(test_base.BaseTestCase):
|
||||
class TestISCSIExtensionCleanUp(base.IronicAgentTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestISCSIExtensionCleanUp, self).setUp()
|
||||
|
@ -14,13 +14,13 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent.extensions import log
|
||||
from ironic_python_agent.tests.unit import base
|
||||
from ironic_python_agent import utils
|
||||
|
||||
|
||||
class TestLogExtension(test_base.BaseTestCase):
|
||||
class TestLogExtension(base.IronicAgentTest):
|
||||
|
||||
def setUp(self):
|
||||
super(TestLogExtension, self).setUp()
|
||||
|
@ -16,10 +16,10 @@ import os
|
||||
|
||||
import mock
|
||||
from oslo_concurrency import processutils
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent.extensions import standby
|
||||
from ironic_python_agent.tests.unit import base
|
||||
|
||||
|
||||
def _build_fake_image_info():
|
||||
@ -53,7 +53,7 @@ def _build_fake_partition_image_info():
|
||||
'deploy_boot_mode': 'bios'}
|
||||
|
||||
|
||||
class TestStandbyExtension(test_base.BaseTestCase):
|
||||
class TestStandbyExtension(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestStandbyExtension, self).setUp()
|
||||
self.agent_extension = standby.StandbyExtension()
|
||||
@ -872,7 +872,7 @@ class TestStandbyExtension(test_base.BaseTestCase):
|
||||
self.assertEqual(expected_msg, result_msg)
|
||||
|
||||
|
||||
class TestImageDownload(test_base.BaseTestCase):
|
||||
class TestImageDownload(base.IronicAgentTest):
|
||||
|
||||
@mock.patch('hashlib.md5', autospec=True)
|
||||
@mock.patch('requests.get', autospec=True)
|
||||
|
@ -16,16 +16,16 @@ import os
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import hardware
|
||||
from ironic_python_agent.hardware_managers import cna
|
||||
from ironic_python_agent.tests.unit import base
|
||||
from ironic_python_agent import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
class TestIntelCnaHardwareManager(test_base.BaseTestCase):
|
||||
class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestIntelCnaHardwareManager, self).setUp()
|
||||
self.hardware = cna.IntelCnaHardwareManager()
|
||||
|
@ -15,17 +15,17 @@
|
||||
import os
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent import hardware
|
||||
from ironic_python_agent.hardware_managers import mlnx
|
||||
from ironic_python_agent.tests.unit import base
|
||||
|
||||
IB_ADDRESS = 'a0:00:00:27:fe:80:00:00:00:00:00:00:7c:fe:90:03:00:29:26:52'
|
||||
CLIENT_ID = 'ff:00:00:00:00:00:02:00:00:02:c9:00:7c:fe:90:03:00:29:26:52'
|
||||
|
||||
|
||||
class MlnxHardwareManager(test_base.BaseTestCase):
|
||||
class MlnxHardwareManager(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(MlnxHardwareManager, self).setUp()
|
||||
self.hardware = mlnx.MellanoxDeviceHardwareManager()
|
||||
|
@ -16,14 +16,14 @@
|
||||
import os
|
||||
|
||||
import mock
|
||||
from oslotest import base as test_base
|
||||
|
||||
from ironic_python_agent import errors
|
||||
from ironic_python_agent import numa_inspector as numa_insp
|
||||
from ironic_python_agent.tests.unit import base
|
||||
from ironic_python_agent import utils
|
||||
|
||||
|
||||
class TestCollectNumaTopologyInfo(test_base.BaseTestCase):
|
||||
class TestCollectNumaTopologyInfo(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestCollectNumaTopologyInfo, self).setUp()
|
||||
self.data = {}
|
||||
@ -115,7 +115,7 @@ class TestCollectNumaTopologyInfo(test_base.BaseTestCase):
|
||||
self.assertFalse(self.failures)
|
||||
|
||||
|
||||
class TestGetNumaTopologyInfo(test_base.BaseTestCase):
|
||||
class TestGetNumaTopologyInfo(base.IronicAgentTest):
|
||||
def setUp(self):
|
||||
super(TestGetNumaTopologyInfo, self).setUp()
|
||||
self.data = {}
|
||||
|
Loading…
Reference in New Issue
Block a user