Fix and enable H403 tests
Multi-line doc-strings should end on a new, separate line. Change-Id: I4cf0cfe92b634ef77971863a4df41ef43531bc20
This commit is contained in:
@@ -183,7 +183,8 @@ def create_image_bdm(image_ref, boot_index=0):
|
||||
|
||||
def legacy_mapping(block_device_mapping):
|
||||
"""Transform a list of block devices of an instance back to the
|
||||
legacy data format."""
|
||||
legacy data format.
|
||||
"""
|
||||
|
||||
legacy_block_device_mapping = []
|
||||
|
||||
|
||||
@@ -157,7 +157,8 @@ def _send_instance_update_notification(context, instance, old_vm_state=None,
|
||||
old_task_state=None, new_vm_state=None, new_task_state=None,
|
||||
service="compute", host=None):
|
||||
"""Send 'compute.instance.update' notification to inform observers
|
||||
about instance state changes"""
|
||||
about instance state changes.
|
||||
"""
|
||||
|
||||
payload = info_from_instance(context, instance, None, None)
|
||||
|
||||
|
||||
@@ -26,7 +26,8 @@ class ComputeCapabilitiesFilter(filters.BaseHostFilter):
|
||||
|
||||
def _satisfies_extra_specs(self, capabilities, instance_type):
|
||||
"""Check that the capabilities provided by the compute service
|
||||
satisfy the extra specs associated with the instance type"""
|
||||
satisfy the extra specs associated with the instance type.
|
||||
"""
|
||||
if 'extra_specs' not in instance_type:
|
||||
return True
|
||||
|
||||
|
||||
@@ -306,8 +306,9 @@ class SchedulerManager(manager.Manager):
|
||||
return self.backdoor_port
|
||||
|
||||
def select_hosts(self, context, request_spec, filter_properties):
|
||||
"""Returns host(s) best suited for this request_spec and
|
||||
filter_properties"""
|
||||
"""Returns host(s) best suited for this request_spec
|
||||
and filter_properties.
|
||||
"""
|
||||
hosts = self.driver.select_hosts(context, request_spec,
|
||||
filter_properties)
|
||||
return jsonutils.to_primitive(hosts)
|
||||
|
||||
@@ -117,7 +117,8 @@ class Service(service.Service):
|
||||
|
||||
A service takes a manager and enables rpc by listening to queues based
|
||||
on topic. It also periodically runs tasks on the manager and reports
|
||||
it state to the database services table."""
|
||||
it state to the database services table.
|
||||
"""
|
||||
|
||||
def __init__(self, host, binary, topic, manager, report_interval=None,
|
||||
periodic_enable=None, periodic_fuzzy_delay=None,
|
||||
|
||||
@@ -77,7 +77,8 @@ class FakeHostManager(host_manager.HostManager):
|
||||
"""host1: free_ram_mb=1024-512-512=0, free_disk_gb=1024-512-512=0
|
||||
host2: free_ram_mb=2048-512=1536 free_disk_gb=2048-512=1536
|
||||
host3: free_ram_mb=4096-1024=3072 free_disk_gb=4096-1024=3072
|
||||
host4: free_ram_mb=8192 free_disk_gb=8192"""
|
||||
host4: free_ram_mb=8192 free_disk_gb=8192
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super(FakeHostManager, self).__init__()
|
||||
|
||||
@@ -41,7 +41,8 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_filter_hosts_avoid(self):
|
||||
"""Test to make sure _filter_hosts() filters original hosts if
|
||||
avoid_original_host is True."""
|
||||
avoid_original_host is True.
|
||||
"""
|
||||
|
||||
hosts = ['host1', 'host2', 'host3']
|
||||
request_spec = dict(instance_properties=dict(host='host2'))
|
||||
@@ -53,7 +54,8 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_filter_hosts_no_avoid(self):
|
||||
"""Test to make sure _filter_hosts() does not filter original
|
||||
hosts if avoid_original_host is False."""
|
||||
hosts if avoid_original_host is False.
|
||||
"""
|
||||
|
||||
hosts = ['host1', 'host2', 'host3']
|
||||
request_spec = dict(instance_properties=dict(host='host2'))
|
||||
|
||||
@@ -160,7 +160,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_schedule_happy_day(self):
|
||||
"""Make sure there's nothing glaringly wrong with _schedule()
|
||||
by doing a happy day pass through."""
|
||||
by doing a happy day pass through.
|
||||
"""
|
||||
|
||||
self.next_weight = 1.0
|
||||
|
||||
@@ -625,7 +626,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_schedule_large_host_pool(self):
|
||||
"""Hosts should still be chosen if pool size
|
||||
is larger than number of filtered hosts"""
|
||||
is larger than number of filtered hosts.
|
||||
"""
|
||||
|
||||
sched = fakes.FakeFilterScheduler()
|
||||
|
||||
@@ -653,7 +655,8 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_schedule_chooses_best_host(self):
|
||||
"""If scheduler_host_subset_size is 1, the largest host with greatest
|
||||
weight should be returned"""
|
||||
weight should be returned.
|
||||
"""
|
||||
|
||||
self.flags(scheduler_host_subset_size=1)
|
||||
|
||||
@@ -697,8 +700,10 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase):
|
||||
|
||||
def test_select_hosts_happy_day(self):
|
||||
"""select_hosts is basically a wrapper around the _select() method.
|
||||
|
||||
Similar to the _select tests, this just does a happy path test to
|
||||
ensure there is nothing glaringly wrong."""
|
||||
ensure there is nothing glaringly wrong.
|
||||
"""
|
||||
|
||||
self.next_weight = 1.0
|
||||
|
||||
|
||||
@@ -931,7 +931,8 @@ class SchedulerTestCase(test.NoDBTestCase):
|
||||
|
||||
class SchedulerDriverBaseTestCase(SchedulerTestCase):
|
||||
"""Test cases for base scheduler driver class methods
|
||||
that can't will fail if the driver is changed"""
|
||||
that can't will fail if the driver is changed.
|
||||
"""
|
||||
|
||||
def test_unimplemented_schedule_run_instance(self):
|
||||
fake_args = (1, 2, 3)
|
||||
|
||||
@@ -208,7 +208,8 @@ def last_completed_audit_period(unit=None, before=None):
|
||||
|
||||
returns: 2 tuple of datetimes (begin, end)
|
||||
The begin timestamp of this audit period is the same as the
|
||||
end of the previous."""
|
||||
end of the previous.
|
||||
"""
|
||||
if not unit:
|
||||
unit = CONF.instance_usage_audit_period
|
||||
|
||||
@@ -637,8 +638,11 @@ def get_shortened_ipv6_cidr(address):
|
||||
|
||||
|
||||
def is_valid_cidr(address):
|
||||
"""Check if the provided ipv4 or ipv6 address is a valid
|
||||
CIDR address or not"""
|
||||
"""Check if address is valid
|
||||
|
||||
The provided address can be a IPv6 or a IPv4
|
||||
CIDR address.
|
||||
"""
|
||||
try:
|
||||
# Validate the correct CIDR Address
|
||||
netaddr.IPNetwork(address)
|
||||
@@ -661,8 +665,10 @@ def is_valid_cidr(address):
|
||||
|
||||
|
||||
def get_ip_version(network):
|
||||
"""Returns the IP version of a network (IPv4 or IPv6). Raises
|
||||
AddrFormatError if invalid network."""
|
||||
"""Returns the IP version of a network (IPv4 or IPv6).
|
||||
|
||||
Raises AddrFormatError if invalid network.
|
||||
"""
|
||||
if netaddr.IPNetwork(network).version == 6:
|
||||
return "IPv6"
|
||||
elif netaddr.IPNetwork(network).version == 4:
|
||||
@@ -1062,7 +1068,8 @@ def get_wrapped_function(function):
|
||||
|
||||
class ExceptionHelper(object):
|
||||
"""Class to wrap another and translate the ClientExceptions raised by its
|
||||
function calls to the actual ones"""
|
||||
function calls to the actual ones.
|
||||
"""
|
||||
|
||||
def __init__(self, target):
|
||||
self._target = target
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -39,7 +39,7 @@ commands =
|
||||
commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E711,E712,H302,H303,H403,H404,F403,F811,F841
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E711,E712,H302,H303,H404,F403,F811,F841
|
||||
builtins = _
|
||||
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,plugins,tools
|
||||
|
||||
|
||||
Reference in New Issue
Block a user