Browse Source

PSExtDriverTestCase: initialize variable in case of exception

Avoid the following when test_create_net_port_security_default
hits an exception before variable network is set:

UnboundLocalError: local variable 'network' referenced before assignment

Related changes:
 - https://review.opendev.org/#/c/188209/
 - https://review.opendev.org/#/c/679399/

Change-Id: I494916567a4df2bef410e8dc54505c289bd55a61
changes/35/692235/1
Flavio Fernandes 3 years ago
parent
commit
cc3886fd78
  1. 1
      neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py

1
neutron/tests/unit/plugins/ml2/test_ext_portsecurity.py

@ -41,6 +41,7 @@ class PSExtDriverTestCase(test_plugin.Ml2PluginV2TestCase,
'shared': False,
'admin_state_up': True,
'status': 'ACTIVE'}}
network = None
try:
network = _core_plugin.create_network(admin_ctx, args)
_value = network[psec.PORTSECURITY]

Loading…
Cancel
Save