Increase version of hacking and pycodestyle

Fix errors in unit tests

Change-Id: Ib5a75fc5e5b6b5661d36e3a27796c3c02ed90056
This commit is contained in:
Riccardo Pittau 2021-07-28 11:33:15 +02:00
parent 652a161f9a
commit 7aec74d4e6
7 changed files with 17 additions and 22 deletions

@ -2870,7 +2870,7 @@ class DoNodeRescueTestCase(mgr_utils.CommonMixIn, mgr_utils.ServiceSetUpMixin,
node.refresh()
self.assertEqual(states.UNRESCUEFAIL, node.provision_state)
self.assertEqual(states.ACTIVE, node.target_provision_state)
self.assertTrue('Unable to unrescue' in node.last_error)
self.assertIn('Unable to unrescue', node.last_error)
self.assertTrue(mock_log.error.called)
@mock.patch.object(manager, 'LOG', autospec=True)
@ -2889,7 +2889,7 @@ class DoNodeRescueTestCase(mgr_utils.CommonMixIn, mgr_utils.ServiceSetUpMixin,
node.refresh()
self.assertEqual(states.UNRESCUEFAIL, node.provision_state)
self.assertEqual(states.ACTIVE, node.target_provision_state)
self.assertTrue('Some failure' in node.last_error)
self.assertIn('Some failure', node.last_error)
self.assertTrue(mock_log.exception.called)
@mock.patch('ironic.drivers.modules.fake.FakeRescue.unrescue',
@ -2905,8 +2905,7 @@ class DoNodeRescueTestCase(mgr_utils.CommonMixIn, mgr_utils.ServiceSetUpMixin,
node.refresh()
self.assertEqual(states.UNRESCUEFAIL, node.provision_state)
self.assertEqual(states.ACTIVE, node.target_provision_state)
self.assertTrue('Driver returned unexpected state' in
node.last_error)
self.assertIn('Driver returned unexpected state', node.last_error)
@mock.patch('ironic.conductor.manager.ConductorManager._spawn_worker',
autospec=True)

@ -855,7 +855,7 @@ class NodePowerActionTestCase(db_base.DbTestCase):
node.refresh()
self.assertEqual(states.POWER_ON, node['power_state'])
self.assertIsNone(node['target_power_state'])
self.assertTrue('unexpected keyword argument' in node['last_error'])
self.assertIn('unexpected keyword argument', node['last_error'])
class NodeSoftPowerActionTestCase(db_base.DbTestCase):

@ -423,7 +423,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
step = 'apply_configuration'
task.driver.bios._execute_post_boot_bios_step(task, step)
driver_info = task.node.driver_internal_info
self.assertTrue('apply_bios' not in driver_info)
self.assertNotIn('apply_bios', driver_info)
ilo_object_mock.get_bios_settings_result.assert_called_once_with()
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
@ -441,7 +441,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
step = 'factory_reset'
task.driver.bios._execute_post_boot_bios_step(task, step)
driver_info = task.node.driver_internal_info
self.assertTrue('reset_bios' not in driver_info)
self.assertNotIn('reset_bios', driver_info)
ilo_object_mock.get_bios_settings_result.assert_called_once_with()
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
@ -463,8 +463,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
self.assertRaises(exept,
task.driver.bios._execute_post_boot_bios_step,
task, step)
self.assertTrue(
'apply_bios' not in task.node.driver_internal_info)
self.assertNotIn('apply_bios', task.node.driver_internal_info)
def test__execute_post_boot_bios_step_invalid_cleaning(self):
self.node.clean_step = {'priority': 100, 'interface': 'bios',
@ -503,8 +502,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
self.assertRaises(exept,
task.driver.bios._execute_post_boot_bios_step,
task, step)
self.assertTrue(
'apply_bios' not in task.node.driver_internal_info)
self.assertNotIn('apply_bios', task.node.driver_internal_info)
def test__execute_post_boot_bios_step_iloobj_failed_cleaning(self):
self.node.clean_step = {'priority': 100, 'interface': 'bios',
@ -543,8 +541,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
[],
[], mdobj,
ilo_object_mock.get_bios_settings_result)
self.assertTrue(
'apply_bios' not in task.node.driver_internal_info)
self.assertNotIn('apply_bios', task.node.driver_internal_info)
def test__execute_post_boot_bios_get_settings_error_cleaning(
self):
@ -584,8 +581,7 @@ class IloBiosTestCase(test_common.BaseIloTest):
self.assertRaises(exept,
task.driver.bios._execute_post_boot_bios_step,
task, step)
self.assertTrue(
'reset_bios' not in task.node.driver_internal_info)
self.assertNotIn('reset_bios', task.node.driver_internal_info)
def test__execute_post_boot_bios_get_settings_failed_cleaning(
self):

@ -1993,7 +1993,7 @@ class IloUefiHttpsBootTestCase(db_base.DbTestCase):
update_secureboot_mock.assert_called_once_with(task)
setup_uefi_https_mock.assert_called_once_with(
task, "recreated-iso", True)
self.assertTrue('boot_iso' not in task.node.instance_info)
self.assertNotIn('boot_iso', task.node.instance_info)
@mock.patch.object(boot_mode_utils, 'deconfigure_secure_boot_if_needed',
spec_set=True, autospec=True)

@ -272,7 +272,7 @@ class TestConvertToVersion(db_base.DbTestCase):
# no conversion
port = objects.Port(self.context, **self.fake_port)
port._convert_to_version("1.7", False)
self.assertFalse('tenant_vif_port_id' in port.internal_info)
self.assertNotIn('tenant_vif_port_id', port.internal_info)
def test_vif_in_extra(self):
for v in ['1.8', '1.9']:
@ -285,7 +285,7 @@ class TestConvertToVersion(db_base.DbTestCase):
port = objects.Port(self.context, **self.fake_port)
port.extra.pop('vif_port_id')
port._convert_to_version('1.8', False)
self.assertFalse('tenant_vif_port_id' in port.internal_info)
self.assertNotIn('tenant_vif_port_id', port.internal_info)
def test_vif_in_extra_in_internal_info(self):
vif2 = 'another_uuid'

@ -179,7 +179,7 @@ class TestConvertToVersion(db_base.DbTestCase):
# no conversion
portgroup = objects.Portgroup(self.context, **self.fake_portgroup)
portgroup._convert_to_version("1.3", False)
self.assertFalse('tenant_vif_port_id' in portgroup.internal_info)
self.assertNotIn('tenant_vif_port_id', portgroup.internal_info)
def test_vif_in_extra(self):
for v in ['1.4', '1.5']:
@ -192,7 +192,7 @@ class TestConvertToVersion(db_base.DbTestCase):
portgroup = objects.Portgroup(self.context, **self.fake_portgroup)
portgroup.extra.pop('vif_port_id')
portgroup._convert_to_version('1.4', False)
self.assertFalse('tenant_vif_port_id' in portgroup.internal_info)
self.assertNotIn('tenant_vif_port_id', portgroup.internal_info)
def test_vif_in_extra_in_internal_info(self):
vif2 = 'another_uuid'

@ -33,9 +33,9 @@ commands = {toxinidir}/tools/states_to_dot.py -f {toxinidir}/doc/source/images/s
[testenv:pep8]
usedevelop = False
deps=
hacking>=3.1.0,<4.0.0 # Apache-2.0
hacking>=4.1.0,<5.0.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0
pycodestyle>=2.0.0,<2.7.0 # MIT
pycodestyle>=2.0.0,<3.0.0 # MIT
flake8-import-order>=0.17.1 # LGPLv3
Pygments>=2.2.0 # BSD
bashate>=0.5.1 # Apache-2.0