Enable pep8 tests for the Nova Ironic Driver

Enable pep8 tests for the Nova Ironic Driver and fix the current pep8
errors. Being able to run pep8 tests against the driver helps the
development because it captures problems like syntax errors, unbound
variables, duplicated methods, etc...

Change-Id: If1da455bb8669b56267cb3ecf45369d5d83a86b7
This commit is contained in:
Lucas Alvares Gomes 2014-03-13 16:46:03 +00:00
parent 9e15b9c511
commit 366f15f591
3 changed files with 5 additions and 9 deletions
ironic/nova
tests/virt/ironic
virt/ironic
tox.ini

@ -122,6 +122,7 @@ class FakeNodeClient(object):
class FakeClient(object):
node = FakeNodeClient()
port = FakePortClient()
@ -157,12 +158,6 @@ class IronicDriverTestCase(test.NoDBTestCase):
def test_get_hypervisor_version(self):
self.assertEqual(self.driver.get_hypervisor_version(), 1)
def test__require_node(self):
node_uuid = '1b67c895-9ef8-42ac-a59c-7bf84fe24e82'
test_instance = fake_instance.fake_instance_obj(self.ctx,
node=node_uuid)
self.assertEqual(self.driver._require_node(test_instance), node_uuid)
def test__get_client_no_context(self):
# stop _get_client mock
self.mock_cli_patcher.stop()

@ -120,6 +120,7 @@ def _get_nodes_supported_instances(cpu_arch=''):
"""Return supported instances for a node."""
return [(cpu_arch, 'baremetal', 'baremetal')]
class IronicDriver(virt_driver.ComputeDriver):
"""Hypervisor driver for Ironic - bare metal provisioning."""
@ -131,7 +132,8 @@ class IronicDriver(virt_driver.ComputeDriver):
self.firewall_driver = firewall.load_driver(default=_FIREWALL_DRIVER)
# TODO(deva): sort out extra_specs and nova-scheduler interaction
extra_specs = {}
extra_specs["ironic_driver"] = "ironic.nova.virt.ironic.driver.IronicDriver"
extra_specs["ironic_driver"] = \
"ironic.nova.virt.ironic.driver.IronicDriver"
# cpu_arch set per node.
extra_specs['cpu_arch'] = ''
for pair in CONF.ironic.instance_type_extra_specs:
@ -461,7 +463,6 @@ class IronicDriver(virt_driver.ComputeDriver):
# TODO(lucasagomes): Make the time configurable
timer.start(interval=10).wait()
def destroy(self, context, instance, network_info,
block_device_info=None):

@ -33,7 +33,7 @@ commands = {posargs}
ignore = E12,E711
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,*ironic/nova*,tools
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
[hacking]
import_exceptions = ironic.openstack.common.gettextutils._,testtools.matchers