Merge "Enforce autospec in some unit tests modules"
This commit is contained in:
commit
c07953ccae
@ -29,7 +29,7 @@ class GetBootModeTestCase(tests_base.TestCase):
|
||||
driver='fake-hardware')
|
||||
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy',
|
||||
autospect=True)
|
||||
autospec=True)
|
||||
def test_get_boot_mode_bios(self, mock_for_deploy):
|
||||
mock_for_deploy.return_value = boot_modes.LEGACY_BIOS
|
||||
boot_mode = boot_mode_utils.get_boot_mode(self.node)
|
||||
@ -42,9 +42,9 @@ class GetBootModeTestCase(tests_base.TestCase):
|
||||
boot_mode = boot_mode_utils.get_boot_mode(self.node)
|
||||
self.assertEqual(boot_modes.UEFI, boot_mode)
|
||||
|
||||
@mock.patch.object(boot_mode_utils, 'LOG', autospect=True)
|
||||
@mock.patch.object(boot_mode_utils, 'LOG', autospec=True)
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy',
|
||||
autospect=True)
|
||||
autospec=True)
|
||||
def test_get_boot_mode_default(self, mock_for_deploy, mock_log):
|
||||
boot_mode_utils.warn_about_default_boot_mode = False
|
||||
mock_for_deploy.return_value = None
|
||||
|
@ -172,7 +172,7 @@ class IPMIToolCheckInitTestCase(base.TestCase):
|
||||
@mock.patch.object(ipmi, '_is_option_supported', autospec=True)
|
||||
@mock.patch.object(utils, 'check_dir', autospec=True)
|
||||
def test_console_init_calls_for_socat(self, mock_check_dir, mock_support):
|
||||
with mock.patch.object(ipmi, 'TMP_DIR_CHECKED'):
|
||||
with mock.patch.object(ipmi, 'TMP_DIR_CHECKED', autospec=True):
|
||||
mock_support.return_value = True
|
||||
ipmi.TMP_DIR_CHECKED = None
|
||||
ipmi.IPMISocatConsole()
|
||||
@ -184,7 +184,7 @@ class IPMIToolCheckInitTestCase(base.TestCase):
|
||||
def test_console_init_calls_for_socat_already_checked(self,
|
||||
mock_check_dir,
|
||||
mock_support):
|
||||
with mock.patch.object(ipmi, 'TMP_DIR_CHECKED'):
|
||||
with mock.patch.object(ipmi, 'TMP_DIR_CHECKED', autospec=True):
|
||||
mock_support.return_value = True
|
||||
ipmi.TMP_DIR_CHECKED = True
|
||||
ipmi.IPMISocatConsole()
|
||||
@ -498,7 +498,8 @@ class IPMIToolPrivateMethodTestCase(
|
||||
# BackoffLoopingCall, it multiplies default interval (equals to 1) by
|
||||
# 2 * return_value, so if you want BackoffLoopingCall to "sleep" for
|
||||
# 1 second, return_value should be 0.5.
|
||||
m = mock.patch.object(random.SystemRandom, 'gauss', return_value=0.5)
|
||||
m = mock.patch.object(random.SystemRandom, 'gauss', return_value=0.5,
|
||||
autospec=True)
|
||||
m.start()
|
||||
self.addCleanup(m.stop)
|
||||
|
||||
@ -2087,7 +2088,8 @@ class IPMIToolDriverTestCase(Base):
|
||||
self.management.set_boot_device,
|
||||
task, boot_devices.PXE)
|
||||
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy')
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy',
|
||||
autospec=True)
|
||||
@mock.patch.object(ipmi, '_exec_ipmitool', autospec=True)
|
||||
def test_management_interface_set_boot_device_uefi(self, mock_exec,
|
||||
mock_boot_mode):
|
||||
@ -2103,7 +2105,8 @@ class IPMIToolDriverTestCase(Base):
|
||||
]
|
||||
mock_exec.assert_has_calls(mock_calls)
|
||||
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy')
|
||||
@mock.patch.object(boot_mode_utils, 'get_boot_mode_for_deploy',
|
||||
autospec=True)
|
||||
@mock.patch.object(ipmi, '_exec_ipmitool', autospec=True)
|
||||
def test_management_interface_set_boot_device_uefi_and_persistent(
|
||||
self, mock_exec, mock_boot_mode):
|
||||
|
16
tox.ini
16
tox.ini
@ -129,7 +129,21 @@ per-file-ignores =
|
||||
ironic/tests/unit/api/*:H210
|
||||
ironic/tests/unit/conductor/*:H210
|
||||
ironic/tests/unit/common/*:H210
|
||||
ironic/tests/unit/drivers/modules/*:H210
|
||||
ironic/tests/unit/drivers/modules/test_agent.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_agent_base.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_console_utils.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_deploy_utils.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_ipxe.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_iscsi_deploy.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_pxe.py:H210
|
||||
ironic/tests/unit/drivers/modules/test_snmp.py:H210
|
||||
ironic/tests/unit/drivers/modules/network/*:H210
|
||||
ironic/tests/unit/drivers/modules/ilo/*:H210
|
||||
ironic/tests/unit/drivers/modules/irmc/*:H210
|
||||
ironic/tests/unit/drivers/modules/xclarity/*:H210
|
||||
ironic/tests/unit/drivers/modules/ansible/*:H210
|
||||
ironic/tests/unit/drivers/modules/drac/*:H210
|
||||
ironic/tests/unit/drivers/modules/storage/*:H210
|
||||
|
||||
[hacking]
|
||||
import_exceptions = testtools.matchers, ironic.common.i18n
|
||||
|
Loading…
x
Reference in New Issue
Block a user