Fix pep8 errors
Recent pep8 upgrade and corresponding pycodestyle update break horizon pep8 job due to the new rules. This commit fixes the following new errors: - E226 missing whitespace around arithmetic operator - E241 multiple spaces after ',' - E731 do not assign a lambda expression, use a def The following errors are added to the ignore list as there are many errors: - E402 module level import not at top of file - W503 line break before binary operator Change-Id: I3478b0684175d2604bbcc1d89cbfca298b97f1e1
This commit is contained in:
@@ -325,7 +325,7 @@ class ManageHostsTests(test.BaseAdminViewTests):
|
|||||||
reverse(constants.AGGREGATES_INDEX_URL))
|
reverse(constants.AGGREGATES_INDEX_URL))
|
||||||
self.assertEqual(self.mock_aggregate_get.call_count, 2)
|
self.assertEqual(self.mock_aggregate_get.call_count, 2)
|
||||||
self.mock_aggregate_get.assert_has_calls(
|
self.mock_aggregate_get.assert_has_calls(
|
||||||
[mock.call(test.IsHttpRequest(), str(aggregate.id))]*2)
|
[mock.call(test.IsHttpRequest(), str(aggregate.id))] * 2)
|
||||||
self.mock_service_list.assert_called_once_with(
|
self.mock_service_list.assert_called_once_with(
|
||||||
test.IsHttpRequest(), binary='nova-compute')
|
test.IsHttpRequest(), binary='nova-compute')
|
||||||
self.mock_add_host_to_aggregate.assert_called_once_with(
|
self.mock_add_host_to_aggregate.assert_called_once_with(
|
||||||
|
@@ -50,7 +50,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
self.mock_extension_supported.assert_has_calls([
|
self.mock_extension_supported.assert_has_calls([
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('Shelve', test.IsHttpRequest())]*4)
|
mock.call('Shelve', test.IsHttpRequest())] * 4)
|
||||||
self.assertEqual(12, self.mock_extension_supported.call_count)
|
self.assertEqual(12, self.mock_extension_supported.call_count)
|
||||||
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
self.mock_image_list_detailed.assert_called_once_with(
|
self.mock_image_list_detailed.assert_called_once_with(
|
||||||
@@ -94,7 +94,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
self.mock_extension_supported.assert_has_calls([
|
self.mock_extension_supported.assert_has_calls([
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('Shelve', test.IsHttpRequest())]*4)
|
mock.call('Shelve', test.IsHttpRequest())] * 4)
|
||||||
self.assertEqual(12, self.mock_extension_supported.call_count)
|
self.assertEqual(12, self.mock_extension_supported.call_count)
|
||||||
self.mock_flavor_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_flavor_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
@@ -143,7 +143,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
self.mock_extension_supported.assert_has_calls([
|
self.mock_extension_supported.assert_has_calls([
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('Shelve', test.IsHttpRequest())]*4)
|
mock.call('Shelve', test.IsHttpRequest())] * 4)
|
||||||
self.assertEqual(12, self.mock_extension_supported.call_count)
|
self.assertEqual(12, self.mock_extension_supported.call_count)
|
||||||
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
self.mock_tenant_list.assert_called_once_with(test.IsHttpRequest())
|
||||||
self.mock_flavor_get.assert_has_calls(
|
self.mock_flavor_get.assert_has_calls(
|
||||||
@@ -247,7 +247,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
self.mock_extension_supported.assert_has_calls([
|
self.mock_extension_supported.assert_has_calls([
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('Shelve', test.IsHttpRequest())]*4)
|
mock.call('Shelve', test.IsHttpRequest())] * 4)
|
||||||
self.assertEqual(12, self.mock_extension_supported.call_count)
|
self.assertEqual(12, self.mock_extension_supported.call_count)
|
||||||
|
|
||||||
@test.create_mocks({
|
@test.create_mocks({
|
||||||
@@ -280,7 +280,7 @@ class InstanceViewTest(test.BaseAdminViewTests):
|
|||||||
self.mock_extension_supported.assert_has_calls([
|
self.mock_extension_supported.assert_has_calls([
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('AdminActions', test.IsHttpRequest()),
|
mock.call('AdminActions', test.IsHttpRequest()),
|
||||||
mock.call('Shelve', test.IsHttpRequest())]*4)
|
mock.call('Shelve', test.IsHttpRequest())] * 4)
|
||||||
self.assertEqual(12, self.mock_extension_supported.call_count)
|
self.assertEqual(12, self.mock_extension_supported.call_count)
|
||||||
search_opts = {'marker': None, 'paginate': True, 'all_tenants': True}
|
search_opts = {'marker': None, 'paginate': True, 'all_tenants': True}
|
||||||
self.mock_server_list.assert_called_once_with(
|
self.mock_server_list.assert_called_once_with(
|
||||||
|
@@ -53,7 +53,8 @@ def sort_flavor_list(request, flavors):
|
|||||||
sort_key = flavor_sort.get('key', 'ram')
|
sort_key = flavor_sort.get('key', 'ram')
|
||||||
rev = flavor_sort.get('reverse', False)
|
rev = flavor_sort.get('reverse', False)
|
||||||
if not callable(sort_key):
|
if not callable(sort_key):
|
||||||
key = lambda flavor: get_key(flavor, sort_key)
|
def key(flavor):
|
||||||
|
return get_key(flavor, sort_key)
|
||||||
else:
|
else:
|
||||||
key = sort_key
|
key = sort_key
|
||||||
flavor_list = [(flavor.id, '%s' % flavor.name)
|
flavor_list = [(flavor.id, '%s' % flavor.name)
|
||||||
|
@@ -153,5 +153,6 @@ class BaseWebObject(unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def wait_till_spinner_disappears(self):
|
def wait_till_spinner_disappears(self):
|
||||||
getter = lambda: self.driver.find_element(*self._spinner_locator)
|
def getter():
|
||||||
|
return self.driver.find_element(*self._spinner_locator)
|
||||||
self.wait_till_element_disappears(getter)
|
self.wait_till_element_disappears(getter)
|
||||||
|
4
tox.ini
4
tox.ini
@@ -155,7 +155,9 @@ commands =
|
|||||||
[flake8]
|
[flake8]
|
||||||
filename = *.py,django.wsgi
|
filename = *.py,django.wsgi
|
||||||
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
|
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
|
||||||
ignore =
|
# E402 module level import not at top of file
|
||||||
|
# W503 line break before binary operator
|
||||||
|
ignore = E402,W503
|
||||||
# Enable the following hacking rules which are disabled by default
|
# Enable the following hacking rules which are disabled by default
|
||||||
# H106 Do not put vim configuration in source files.
|
# H106 Do not put vim configuration in source files.
|
||||||
# H203 Use assertIs(Not)None to check for None.
|
# H203 Use assertIs(Not)None to check for None.
|
||||||
|
Reference in New Issue
Block a user