Browse Source

Remove the dependency on the "mock" package

Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Fixed an inconsistency in the OVSBridge.deferred() definition
as it needs to also have an *args argument.

Fixed an issue where an l3-agent test was mocking
functools.partial, causing a python3.8 failure.

Unit tests only, removing from tests/base.py affects
functional tests which need additional work.

Change-Id: I40e8a8410840c3774c72ae1a8054574445d66ece
changes/79/711579/12
Brian Haley 1 year ago
parent
commit
7594bb0627
  1. 4
      neutron/agent/common/ovs_lib.py
  2. 2
      neutron/tests/unit/agent/common/test_async_process.py
  3. 2
      neutron/tests/unit/agent/common/test_ovs_lib.py
  4. 3
      neutron/tests/unit/agent/common/test_ovsdb_monitor.py
  5. 3
      neutron/tests/unit/agent/common/test_placement_report.py
  6. 2
      neutron/tests/unit/agent/common/test_polling.py
  7. 3
      neutron/tests/unit/agent/common/test_utils.py
  8. 2
      neutron/tests/unit/agent/dhcp/test_agent.py
  9. 2
      neutron/tests/unit/agent/l2/extensions/test_fdb_population.py
  10. 3
      neutron/tests/unit/agent/l2/extensions/test_qos.py
  11. 3
      neutron/tests/unit/agent/l2/test_l2_agent_extensions_manager.py
  12. 3
      neutron/tests/unit/agent/l3/extensions/qos/test_base.py
  13. 3
      neutron/tests/unit/agent/l3/extensions/qos/test_fip.py
  14. 2
      neutron/tests/unit/agent/l3/extensions/qos/test_gateway_ip.py
  15. 2
      neutron/tests/unit/agent/l3/extensions/test_conntrack_helper.py
  16. 3
      neutron/tests/unit/agent/l3/extensions/test_port_forwarding.py
  17. 3
      neutron/tests/unit/agent/l3/extensions/test_snat_log.py
  18. 10
      neutron/tests/unit/agent/l3/test_agent.py
  19. 2
      neutron/tests/unit/agent/l3/test_dvr_fip_ns.py
  20. 3
      neutron/tests/unit/agent/l3/test_dvr_local_router.py
  21. 3
      neutron/tests/unit/agent/l3/test_dvr_snat_ns.py
  22. 2
      neutron/tests/unit/agent/l3/test_ha_router.py
  23. 2
      neutron/tests/unit/agent/l3/test_item_allocator.py
  24. 2
      neutron/tests/unit/agent/l3/test_l3_agent_extension_api.py
  25. 3
      neutron/tests/unit/agent/l3/test_legacy_router.py
  26. 3
      neutron/tests/unit/agent/l3/test_namespace_manager.py
  27. 3
      neutron/tests/unit/agent/l3/test_router_info.py
  28. 3
      neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py
  29. 2
      neutron/tests/unit/agent/linux/openvswitch_firewall/test_iptables.py
  30. 3
      neutron/tests/unit/agent/linux/openvswitch_firewall/test_rules.py
  31. 3
      neutron/tests/unit/agent/linux/test_bridge_lib.py
  32. 2
      neutron/tests/unit/agent/linux/test_daemon.py
  33. 2
      neutron/tests/unit/agent/linux/test_dhcp.py
  34. 2
      neutron/tests/unit/agent/linux/test_external_process.py
  35. 3
      neutron/tests/unit/agent/linux/test_interface.py
  36. 2
      neutron/tests/unit/agent/linux/test_ip_conntrack.py
  37. 2
      neutron/tests/unit/agent/linux/test_ip_lib.py
  38. 3
      neutron/tests/unit/agent/linux/test_ip_link_support.py
  39. 2
      neutron/tests/unit/agent/linux/test_ipset_manager.py
  40. 2
      neutron/tests/unit/agent/linux/test_iptables_firewall.py
  41. 2
      neutron/tests/unit/agent/linux/test_iptables_manager.py
  42. 2
      neutron/tests/unit/agent/linux/test_keepalived.py
  43. 3
      neutron/tests/unit/agent/linux/test_l3_tc_lib.py
  44. 2
      neutron/tests/unit/agent/linux/test_pd.py
  45. 3
      neutron/tests/unit/agent/linux/test_tc_lib.py
  46. 2
      neutron/tests/unit/agent/linux/test_utils.py
  47. 3
      neutron/tests/unit/agent/linux/test_xenapi_root_helper.py
  48. 3
      neutron/tests/unit/agent/metadata/test_agent.py
  49. 2
      neutron/tests/unit/agent/metadata/test_driver.py
  50. 2
      neutron/tests/unit/agent/ovn/metadata/test_agent.py
  51. 2
      neutron/tests/unit/agent/ovn/metadata/test_driver.py
  52. 2
      neutron/tests/unit/agent/ovn/metadata/test_server.py
  53. 2
      neutron/tests/unit/agent/ovsdb/native/test_connection.py
  54. 4
      neutron/tests/unit/agent/ovsdb/test_impl_idl.py
  55. 3
      neutron/tests/unit/agent/test_agent_extensions_manager.py
  56. 3
      neutron/tests/unit/agent/test_resource_cache.py
  57. 2
      neutron/tests/unit/agent/test_rpc.py
  58. 2
      neutron/tests/unit/agent/test_securitygroups_rpc.py
  59. 3
      neutron/tests/unit/agent/windows/test_ip_lib.py
  60. 2
      neutron/tests/unit/agent/windows/test_utils.py
  61. 2
      neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py
  62. 2
      neutron/tests/unit/api/rpc/agentnotifiers/test_l3_rpc_agent_api.py
  63. 2
      neutron/tests/unit/api/rpc/callbacks/consumer/test_registry.py
  64. 2
      neutron/tests/unit/api/rpc/callbacks/test_resource_manager.py
  65. 2
      neutron/tests/unit/api/rpc/callbacks/test_version_manager.py
  66. 3
      neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py
  67. 2
      neutron/tests/unit/api/rpc/handlers/test_dvr_rpc.py
  68. 3
      neutron/tests/unit/api/rpc/handlers/test_resources_rpc.py
  69. 3
      neutron/tests/unit/api/rpc/handlers/test_securitygroups_rpc.py
  70. 2
      neutron/tests/unit/api/test_extensions.py
  71. 2
      neutron/tests/unit/api/v2/test_base.py
  72. 3
      neutron/tests/unit/api/v2/test_resource.py
  73. 2
      neutron/tests/unit/api/v2/test_router.py
  74. 2
      neutron/tests/unit/cmd/test_netns_cleanup.py
  75. 2
      neutron/tests/unit/cmd/test_ovs_cleanup.py
  76. 3
      neutron/tests/unit/cmd/test_sanity_check.py
  77. 2
      neutron/tests/unit/cmd/test_status.py
  78. 3
      neutron/tests/unit/cmd/upgrade_checks/test_checks.py
  79. 2
      neutron/tests/unit/common/ovn/test_acl.py
  80. 2
      neutron/tests/unit/common/ovn/test_hash_ring_manager.py
  81. 3
      neutron/tests/unit/common/test__deprecate.py
  82. 3
      neutron/tests/unit/common/test_cache_utils.py
  83. 3
      neutron/tests/unit/common/test_coordination.py
  84. 2
      neutron/tests/unit/common/test_utils.py
  85. 2
      neutron/tests/unit/core_extensions/test_qos.py
  86. 2
      neutron/tests/unit/db/quota/test_api.py
  87. 3
      neutron/tests/unit/db/test__utils.py
  88. 2
      neutron/tests/unit/db/test_agents_db.py
  89. 2
      neutron/tests/unit/db/test_agentschedulers_db.py
  90. 2
      neutron/tests/unit/db/test_db_base_plugin_v2.py
  91. 3
      neutron/tests/unit/db/test_dvr_mac_db.py
  92. 3
      neutron/tests/unit/db/test_extraroute_db.py
  93. 3
      neutron/tests/unit/db/test_ipam_backend_mixin.py
  94. 2
      neutron/tests/unit/db/test_ipam_pluggable_backend.py
  95. 3
      neutron/tests/unit/db/test_l3_db.py
  96. 3
      neutron/tests/unit/db/test_l3_dvr_db.py
  97. 2
      neutron/tests/unit/db/test_l3_hamode_db.py
  98. 2
      neutron/tests/unit/db/test_migration.py
  99. 2
      neutron/tests/unit/db/test_ovn_hash_ring_db.py
  100. 2
      neutron/tests/unit/db/test_ovn_revision_numbers_db.py

4
neutron/agent/common/ovs_lib.py

@ -500,8 +500,8 @@ class OVSBridge(BaseOVS):
return [f for f in self.run_ofctl("dump-flows", []).splitlines()
if is_a_flow_line(f)]
def deferred(self, **kwargs):
return DeferredOVSBridge(self, **kwargs)
def deferred(self, *args, **kwargs):
return DeferredOVSBridge(self, *args, **kwargs)
def add_tunnel_port(self, port_name, remote_ip, local_ip,
tunnel_type=p_const.TYPE_GRE,

2
neutron/tests/unit/agent/common/test_async_process.py

@ -14,11 +14,11 @@
import signal
import sys
from unittest import mock
import eventlet.event
from eventlet.green import subprocess
import eventlet.queue
import mock
import testtools
from neutron.agent.common import async_process

2
neutron/tests/unit/agent/common/test_ovs_lib.py

@ -13,8 +13,8 @@
# under the License.
import collections
from unittest import mock
import mock
from neutron_lib import exceptions
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

3
neutron/tests/unit/agent/common/test_ovsdb_monitor.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_serialization import jsonutils
from neutron.agent.common import async_process

3
neutron/tests/unit/agent/common/test_placement_report.py

@ -12,10 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import mock
import uuid
import mock
from neutron.agent.common import placement_report
from neutron.tests import base

2
neutron/tests/unit/agent/common/test_polling.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.agent.common import base_polling
from neutron.agent.common import polling

3
neutron/tests/unit/agent/common/test_utils.py

@ -14,8 +14,7 @@
# under the License.
import socket
import mock
from unittest import mock
from neutron.agent.common import utils
from neutron.agent.linux import interface

2
neutron/tests/unit/agent/dhcp/test_agent.py

@ -16,10 +16,10 @@
import collections
import copy
import sys
from unittest import mock
import uuid
import eventlet
import mock
from neutron_lib.agent import constants as agent_consts
from neutron_lib import constants as const
from neutron_lib import exceptions

2
neutron/tests/unit/agent/l2/extensions/test_fdb_population.py

@ -14,8 +14,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutron_lib import constants
from neutron_lib.utils import helpers
from oslo_config import cfg

3
neutron/tests/unit/agent/l2/extensions/test_qos.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as common_constants
from neutron_lib import context
from neutron_lib.db import constants as db_consts

3
neutron/tests/unit/agent/l2/test_l2_agent_extensions_manager.py

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from neutron.agent.l2 import l2_agent_extensions_manager as l2_ext_manager

3
neutron/tests/unit/agent/l3/extensions/qos/test_base.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from neutron.agent.l3.extensions.qos import base as qos_base

3
neutron/tests/unit/agent/l3/extensions/qos/test_fip.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as lib_const
from neutron_lib import context
from neutron_lib import rpc as n_rpc

2
neutron/tests/unit/agent/l3/extensions/qos/test_gateway_ip.py

@ -14,8 +14,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutron_lib import constants as lib_const
from neutron_lib import context
from oslo_utils import uuidutils

2
neutron/tests/unit/agent/l3/extensions/test_conntrack_helper.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants
from neutron_lib import context

3
neutron/tests/unit/agent/l3/extensions/test_port_forwarding.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import netaddr
from neutron_lib import constants as lib_const
from neutron_lib import context

3
neutron/tests/unit/agent/l3/extensions/test_snat_log.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as lib_const
from neutron.agent.l3.extensions import snat_log

10
neutron/tests/unit/agent/l3/test_agent.py

@ -14,15 +14,14 @@
# under the License.
import copy
import functools
from itertools import chain as iter_chain
from itertools import combinations as iter_combinations
import os
import pwd
from unittest import mock
import eventlet
import fixtures
import mock
import netaddr
from neutron_lib.agent import constants as agent_consts
from neutron_lib.api.definitions import portbindings
@ -3998,14 +3997,11 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
ri.remove_floating_ip.assert_called_once_with(
device, need_to_remove_fip[0]['cidr'])
@mock.patch.object(functools, 'partial')
@mock.patch.object(common_utils, 'load_interface_driver')
def test_interface_driver_init(self, load_driver_mock, funct_partial_mock):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
def test_interface_driver_init(self, load_driver_mock):
l3_agent.L3NATAgent(HOSTNAME, self.conf)
load_driver_mock.assert_called_once_with(
self.conf, get_networks_callback=mock.ANY)
funct_partial_mock.assert_called_once_with(
self.plugin_api.get_networks, agent.context)
def test_stop_no_cleanup(self):
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)

2
neutron/tests/unit/agent/l3/test_dvr_fip_ns.py

@ -13,8 +13,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutron_lib.exceptions import l3 as l3_exc
from oslo_config import cfg
from oslo_utils import uuidutils

3
neutron/tests/unit/agent/l3/test_dvr_local_router.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants as lib_constants
from oslo_config import cfg

3
neutron/tests/unit/agent/l3/test_dvr_snat_ns.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_utils import uuidutils

2
neutron/tests/unit/agent/l3/test_ha_router.py

@ -14,8 +14,8 @@
import copy
import signal
from unittest import mock
import mock
from neutron_lib import constants as n_consts
from neutron_lib import fixture as lib_fixtures
from oslo_utils import uuidutils

2
neutron/tests/unit/agent/l3/test_item_allocator.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.agent.l3 import item_allocator as ia
from neutron.tests import base

2
neutron/tests/unit/agent/l3/test_l3_agent_extension_api.py

@ -14,7 +14,7 @@
# under the License.
#
import mock
from unittest import mock
from oslo_utils import uuidutils

3
neutron/tests/unit/agent/l3/test_legacy_router.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as lib_constants
from oslo_utils import uuidutils

3
neutron/tests/unit/agent/l3/test_namespace_manager.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_utils import uuidutils
from neutron.agent.l3 import dvr_fip_ns

3
neutron/tests/unit/agent/l3/test_router_info.py

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as lib_constants
from neutron_lib.exceptions import l3 as l3_exc
from oslo_utils import uuidutils

3
neutron/tests/unit/agent/linux/openvswitch_firewall/test_firewall.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.callbacks import events as callbacks_events
from neutron_lib.callbacks import registry as callbacks_registry
from neutron_lib.callbacks import resources as callbacks_resources

2
neutron/tests/unit/agent/linux/openvswitch_firewall/test_iptables.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.agent.linux import iptables_firewall
from neutron.agent.linux.openvswitch_firewall import iptables

3
neutron/tests/unit/agent/linux/openvswitch_firewall/test_rules.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants
from neutron.agent.linux.openvswitch_firewall import constants as ovsfw_consts

3
neutron/tests/unit/agent/linux/test_bridge_lib.py

@ -15,7 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_utils import netutils
from neutron.agent.linux import bridge_lib

2
neutron/tests/unit/agent/linux/test_daemon.py

@ -17,8 +17,8 @@ import logging
from logging import handlers
import os
import sys
from unittest import mock
import mock
from neutron_lib import exceptions
from neutron_lib import fixture as lib_fixtures
import testtools

2
neutron/tests/unit/agent/linux/test_dhcp.py

@ -15,8 +15,8 @@
import copy
import os
from unittest import mock
import mock
import netaddr
from neutron_lib.api.definitions import extra_dhcp_opt as edo_ext
from neutron_lib import constants

2
neutron/tests/unit/agent/linux/test_external_process.py

@ -13,8 +13,8 @@
# under the License.
import os.path
from unittest import mock
import mock
from neutron_lib import fixture as lib_fixtures
from oslo_config import cfg
from oslo_utils import fileutils

3
neutron/tests/unit/agent/linux/test_interface.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants
from oslo_utils import excutils
from pyroute2.netlink import exceptions as pyroute2_exc

2
neutron/tests/unit/agent/linux/test_ip_conntrack.py

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron.agent.linux import ip_conntrack
from neutron.tests import base

2
neutron/tests/unit/agent/linux/test_ip_lib.py

@ -16,8 +16,8 @@
import copy
import errno
import socket
from unittest import mock
import mock
import netaddr
from neutron_lib import constants
from neutron_lib import exceptions

3
neutron/tests/unit/agent/linux/test_ip_link_support.py

@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron.agent.linux import ip_link_support as ip_link
from neutron.tests import base

2
neutron/tests/unit/agent/linux/test_ipset_manager.py

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron.agent.linux import ipset_manager
from neutron.tests import base

2
neutron/tests/unit/agent/linux/test_iptables_firewall.py

@ -14,8 +14,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutron_lib import constants
from neutron_lib import exceptions
from oslo_config import cfg

2
neutron/tests/unit/agent/linux/test_iptables_manager.py

@ -15,9 +15,9 @@
import os
import sys
from unittest import mock
import fixtures
import mock
from neutron_lib import constants
from neutron_lib import exceptions
from neutron_lib.exceptions import l3 as l3_exc

2
neutron/tests/unit/agent/linux/test_keepalived.py

@ -15,8 +15,8 @@
import os
import textwrap
from unittest import mock
import mock
from neutron_lib import constants as n_consts
import testtools

3
neutron/tests/unit/agent/linux/test_l3_tc_lib.py

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants
from neutron_lib import exceptions

2
neutron/tests/unit/agent/linux/test_pd.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.agent.l3 import dvr_edge_router
from neutron.agent.l3 import dvr_local_router

3
neutron/tests/unit/agent/linux/test_tc_lib.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants
from neutron_lib.exceptions import qos as qos_exc
from neutron_lib.services.qos import constants as qos_consts

2
neutron/tests/unit/agent/linux/test_utils.py

@ -15,8 +15,8 @@
import copy
import signal
import socket
from unittest import mock
import mock
import six
import testtools

3
neutron/tests/unit/agent/linux/test_xenapi_root_helper.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_rootwrap import cmd as oslo_rootwrap_cmd

3
neutron/tests/unit/agent/metadata/test_agent.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import constants as n_const
import testtools
import webob

2
neutron/tests/unit/agent/metadata/test_driver.py

@ -14,8 +14,8 @@
# under the License.
import os
from unittest import mock
import mock
from neutron_lib import constants
from neutron_lib import fixture as lib_fixtures
from oslo_config import cfg

2
neutron/tests/unit/agent/ovn/metadata/test_agent.py

@ -13,8 +13,8 @@
# limitations under the License.
import collections
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture

2
neutron/tests/unit/agent/ovn/metadata/test_driver.py

@ -14,8 +14,8 @@
# under the License.
import os
from unittest import mock
import mock
from neutron_lib import fixture as lib_fixtures
from oslo_config import cfg
from oslo_utils import uuidutils

2
neutron/tests/unit/agent/ovn/metadata/test_server.py

@ -13,8 +13,8 @@
# limitations under the License.
import collections
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from oslo_utils import fileutils

2
neutron/tests/unit/agent/ovsdb/native/test_connection.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ovs.db import idl
from ovs import jsonrpc

4
neutron/tests/unit/agent/ovsdb/test_impl_idl.py

@ -12,10 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import testtools
from unittest import mock
from ovsdbapp import exceptions
import testtools
from neutron.agent.ovsdb import impl_idl
from neutron.tests import base

3
neutron/tests/unit/agent/test_agent_extensions_manager.py

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from neutron.agent import agent_extensions_manager as ext_manager

3
neutron/tests/unit/agent/test_resource_cache.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib import context

2
neutron/tests/unit/agent/test_rpc.py

@ -14,8 +14,8 @@
# under the License.
import datetime
from unittest import mock
import mock
import netaddr
from neutron_lib.agent import topics as lib_topics
from neutron_lib.callbacks import events

2
neutron/tests/unit/agent/test_securitygroups_rpc.py

@ -15,8 +15,8 @@
import collections
import contextlib
from unittest import mock
import mock
import netaddr
from neutron_lib.api.definitions import allowedaddresspairs as addr_apidef
from neutron_lib import constants as const

3
neutron/tests/unit/agent/windows/test_ip_lib.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import netifaces
from neutron.agent.windows import ip_lib

2
neutron/tests/unit/agent/windows/test_utils.py

@ -14,11 +14,11 @@
# under the License.
import io
from unittest import mock
import ddt
import eventlet
from eventlet import tpool
import mock
from neutron_lib import exceptions
import six

2
neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py

@ -15,8 +15,8 @@
import copy
import datetime
from unittest import mock
import mock
from neutron_lib.api import extensions
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry

2
neutron/tests/unit/api/rpc/agentnotifiers/test_l3_rpc_agent_api.py

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron_lib import rpc

2
neutron/tests/unit/api/rpc/callbacks/consumer/test_registry.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.api.rpc.callbacks.consumer import registry
from neutron.tests import base

2
neutron/tests/unit/api/rpc/callbacks/test_resource_manager.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.callbacks import exceptions

2
neutron/tests/unit/api/rpc/callbacks/test_version_manager.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.api.rpc.callbacks import exceptions
from neutron.api.rpc.callbacks import resources

3
neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import resources
from neutron_lib import constants

2
neutron/tests/unit/api/rpc/handlers/test_dvr_rpc.py

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron.api.rpc.handlers import dvr_rpc
from neutron.tests import base

3
neutron/tests/unit/api/rpc/handlers/test_resources_rpc.py

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron_lib.agent import topics
from neutron_lib import context
from neutron_lib.objects import common_types

3
neutron/tests/unit/api/rpc/handlers/test_securitygroups_rpc.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import netaddr
from neutron_lib import context
from oslo_utils import uuidutils

2
neutron/tests/unit/api/test_extensions.py

@ -14,9 +14,9 @@
# under the License.
import copy
from unittest import mock
import fixtures
import mock
from neutron_lib import exceptions
from neutron_lib.plugins import constants as lib_const
from neutron_lib.plugins import directory

2
neutron/tests/unit/api/v2/test_base.py

@ -14,8 +14,8 @@
# under the License.
import os
from unittest import mock
import mock
from neutron_lib.api import attributes
from neutron_lib.api import converters
from neutron_lib.api.definitions import empty_string_filtering

3
neutron/tests/unit/api/v2/test_resource.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import context
from neutron_lib import exceptions as n_exc
import oslo_i18n

2
neutron/tests/unit/api/v2/test_router.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.api.v2 import router
from neutron.tests import base

2
neutron/tests/unit/cmd/test_netns_cleanup.py

@ -14,8 +14,8 @@
# under the License.
import signal
from unittest import mock
import mock
import testtools
from neutron.cmd import netns_cleanup as util

2
neutron/tests/unit/cmd/test_ovs_cleanup.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.cmd import ovs_cleanup as util
from neutron.tests import base

3
neutron/tests/unit/cmd/test_sanity_check.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from neutron.cmd import sanity_check

2
neutron/tests/unit/cmd/test_status.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron.cmd import status
from neutron.tests import base

3
neutron/tests/unit/cmd/upgrade_checks/test_checks.py

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_upgradecheck.upgradecheck import Code

2
neutron/tests/unit/common/ovn/test_acl.py

@ -12,8 +12,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutron_lib import constants as const
from oslo_config import cfg
from ovsdbapp.backend.ovs_idl import idlutils

2
neutron/tests/unit/common/ovn/test_hash_ring_manager.py

@ -14,8 +14,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from neutron_lib import context
from oslo_utils import timeutils

3
neutron/tests/unit/common/test__deprecate.py

@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from oslo_utils import importutils
from neutron.tests import base

3
neutron/tests/unit/common/test_cache_utils.py

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as config_fixture

3
neutron/tests/unit/common/test_coordination.py

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_concurrency import lockutils
from neutron.common import coordination

2
neutron/tests/unit/common/test_utils.py

@ -17,11 +17,11 @@ import random
import re
import sys
import time
from unittest import mock
import ddt
import eventlet
from eventlet import queue
import mock
import netaddr
from neutron_lib import constants
from oslo_log import log as logging

2
neutron/tests/unit/core_extensions/test_qos.py

@ -14,8 +14,8 @@
# under the License.
import itertools
from unittest import mock
import mock
from neutron_lib import context
from neutron_lib.exceptions import qos as qos_exc
from neutron_lib.plugins import constants as plugin_constants

2
neutron/tests/unit/db/quota/test_api.py

@ -13,8 +13,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from neutron_lib import context
from neutron_lib.plugins import constants as const
from neutron_lib.plugins import directory

3
neutron/tests/unit/db/test__utils.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib import context
from neutron.db import _utils as db_utils

2
neutron/tests/unit/db/test_agents_db.py

@ -16,8 +16,8 @@
import copy
import datetime
from unittest import mock
import mock
from neutron_lib import constants
from neutron_lib import context
from neutron_lib.db import api as db_api

2
neutron/tests/unit/db/test_agentschedulers_db.py

@ -14,8 +14,8 @@
# limitations under the License.
import datetime
from unittest import mock
import mock
from neutron_lib.api.definitions import dhcpagentscheduler as das_apidef
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants

2
neutron/tests/unit/db/test_db_base_plugin_v2.py

@ -18,9 +18,9 @@ import copy
import functools
import itertools
import random
from unittest import mock
import eventlet
import mock
import netaddr
from neutron_lib.callbacks import exceptions
from neutron_lib.callbacks import registry

3
neutron/tests/unit/db/test_dvr_mac_db.py

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry

3
neutron/tests/unit/db/test_extraroute_db.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry
from neutron_lib import context

3
neutron/tests/unit/db/test_ipam_backend_mixin.py

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import netaddr
from neutron_lib.api.definitions import portbindings
from neutron_lib import constants

2
neutron/tests/unit/db/test_ipam_pluggable_backend.py

@ -14,8 +14,8 @@
# under the License.
import copy
from unittest import mock
import mock
import netaddr
from neutron_lib import constants
from neutron_lib import context as ncontext

3
neutron/tests/unit/db/test_l3_db.py

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import netaddr
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry

3
neutron/tests/unit/db/test_l3_dvr_db.py

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from neutron_lib.api.definitions import portbindings
from neutron_lib.callbacks import events
from neutron_lib.callbacks import registry

2
neutron/tests/unit/db/test_l3_hamode_db.py

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutron_lib.api.definitions import dvr as dvr_apidef
from neutron_lib.api.definitions import external_net as extnet_apidef

2
neutron/tests/unit/db/test_migration.py

@ -18,13 +18,13 @@ import os
import re
import sys
import textwrap
from unittest import mock
from alembic.autogenerate import api as alembic_ag_api
from alembic import config as alembic_config
from alembic.operations import ops as alembic_ops
from alembic import script as alembic_script
import fixtures
import mock
from neutron_lib import fixture as lib_fixtures
from neutron_lib.utils import helpers
from oslo_utils import fileutils

2
neutron/tests/unit/db/test_ovn_hash_ring_db.py

@ -14,8 +14,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from neutron_lib import context
from neutron_lib.db import api as db_api
from oslo_utils import timeutils

2
neutron/tests/unit/db/test_ovn_revision_numbers_db.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import