Merge "Remove some useless else statements"

This commit is contained in:
Zuul 2023-12-06 08:38:25 +00:00 committed by Gerrit Code Review
commit 71e056e614
9 changed files with 19 additions and 30 deletions

View File

@ -525,7 +525,6 @@ class BaseTestCase(DietTestCase):
if e:
if raise_on_exception:
raise e
else:
threads_exceptions.append(e)
return threads_exceptions

View File

@ -40,7 +40,6 @@ class AlwaysTheOtherAgentScheduler(base_scheduler.BaseChanceScheduler,
for agent in resource_hostable_agents:
if agent.id in self.last_selected_agent_ids:
continue
else:
possible_agents.append(agent)
num_agents = min(len(possible_agents), num_agents_needed)
self.last_selected_agent_ids = [

View File

@ -83,7 +83,6 @@ class BaseOVSTestCase(base.BaseSudoTestCase):
for queue in (queue for queue in queues
if queue['_uuid'] == queue_id):
return queue
else:
return None
return queues
@ -121,7 +120,6 @@ class BaseOVSTestCase(base.BaseSudoTestCase):
if qos_id:
for qos in (qos for qos in qoses if qos['_uuid'] == qos_id):
return qos
else:
return None
return qoses

View File

@ -401,7 +401,6 @@ class TestMetadataAgent(base.TestOVNFunctionalBase):
for rule in iptables_mgr.get_rules_for_table('mangle'):
if regex.match(rule):
return
else:
self.fail('Rule not found in "mangle" table, in namespace %s' %
namespace)

View File

@ -66,7 +66,7 @@ class OVSAgentTestBase(test_ovs_lib.OVSBridgeTestBase,
(l, sep, r) = line.partition(':')
if not sep:
continue
elif l in required_keys:
if l in required_keys:
trace[l] = r
for k in required_keys:
if k not in trace:

View File

@ -204,7 +204,6 @@ class GetLinkDevicesTestCase(functional_base.BaseSudoTestCase):
for device in priv_ip_lib.get_link_devices(namespace):
if interface_name == linux_utils.get_attr(device, 'IFLA_IFNAME'):
return device
else:
self.fail('Interface "%s" not found' % interface_name)
def test_get_link_devices_veth_different_namespaces(self):
@ -280,7 +279,6 @@ class BaseIpRuleTestCase(functional_base.BaseSudoTestCase):
else:
if raise_exception:
self.fail('Rule with %s was expected' % exception_string)
else:
return False

View File

@ -121,9 +121,7 @@ class RuleScopesTestCase(PolicyBaseTestCase):
if len(rule.scope_types) == 1:
# If rule has only one scope, it's fine
continue
else:
expected_scope_types = SCOPE_TYPES_EXCEPTIONS.get(
rule_name, [])
expected_scope_types = SCOPE_TYPES_EXCEPTIONS.get(rule_name, [])
fail_msg = (
"Rule %s have scope types %s which are not defined "
"in the exceptions list: %s" % (

View File

@ -126,7 +126,6 @@ class TestDbBasePluginIpam(test_db_base.NeutronDbPluginV2TestCase):
if isinstance(request, ipam_req.SpecificAddressRequest):
if request.address == netaddr.IPAddress(fail_ip):
raise exception
else:
return str(request.address), subnet_id
else:
return auto_ip, subnet_id

View File

@ -1451,7 +1451,6 @@ class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
call_info['count'] += 1
if call_info['count'] == 2:
raise RuntimeError()
else:
return orig_update_port(*args, **kwargs)
# NOTE(trananhkma): expect that update_port() only raises an error