Fix used-before-assignment warnings

Moved some code around to avoid the warning.

No functional change.

TrivialFix

Change-Id: I5451e411dccf639dcab50ed10edf0cf57edeac45
This commit is contained in:
Brian Haley 2024-02-12 21:32:25 -05:00
parent 267690b505
commit 16474fcf24
2 changed files with 9 additions and 13 deletions

View File

@ -1583,27 +1583,22 @@ class OvsDhcpAgentNotifierTestCase(test_agent.AgentDBTestMixIn,
hosts = [DHCP_HOSTA, DHCP_HOSTC, DHCP_HOSTD]
net, subnet, port = self._network_port_create(hosts)
for host_call in self.dhcp_notifier_cast.call_args_list:
host_call = str(host_call)
if ("'priority': " + str(
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_HIGH)
in str(host_call)):
if DHCP_HOSTA in str(host_call):
expected_high_calls = self._notification_mocks(
[DHCP_HOSTA], net, subnet, port,
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_HIGH)
in host_call):
if DHCP_HOSTA in host_call:
high_host = DHCP_HOSTA
hosts.pop(0)
elif DHCP_HOSTC in str(host_call):
expected_high_calls = self._notification_mocks(
[DHCP_HOSTC], net, subnet, port,
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_HIGH)
elif DHCP_HOSTC in host_call:
high_host = DHCP_HOSTC
hosts.pop(1)
elif DHCP_HOSTD in str(host_call):
expected_high_calls = self._notification_mocks(
[DHCP_HOSTD], net, subnet, port,
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_HIGH)
elif DHCP_HOSTD in host_call:
high_host = DHCP_HOSTD
hosts.pop(2)
expected_high_calls = self._notification_mocks(
[high_host], net, subnet, port,
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_HIGH)
expected_low_calls = self._notification_mocks(
hosts, net, subnet, port,
dhcp_rpc_agent_api.PRIORITY_PORT_CREATE_LOW)

View File

@ -23,6 +23,7 @@ from neutron.tests import post_mortem_debug
class TestTesttoolsExceptionHandler(base.BaseTestCase):
def test_exception_handler(self):
exc_info = None
try:
self.fail()
except Exception: