Browse Source

Use unittest.mock instead of third party mock

Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I12e1a2a4a22116cabd09a3b808f871d98e4bd1f2
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
changes/95/720995/3
Sean McGinnis 1 year ago
parent
commit
4669bcc628
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
  1. 1
      lower-constraints.txt
  2. 2
      neutronclient/tests/unit/bgp/test_cli20_speaker.py
  3. 2
      neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py
  4. 2
      neutronclient/tests/unit/lb/test_cli20_healthmonitor.py
  5. 2
      neutronclient/tests/unit/lb/test_cli20_pool.py
  6. 2
      neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py
  7. 2
      neutronclient/tests/unit/osc/v2/dynamic_routing/fakes.py
  8. 2
      neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_dragent.py
  9. 2
      neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_peer.py
  10. 2
      neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_speaker.py
  11. 2
      neutronclient/tests/unit/osc/v2/fakes.py
  12. 2
      neutronclient/tests/unit/osc/v2/fwaas/fakes.py
  13. 2
      neutronclient/tests/unit/osc/v2/fwaas/test_firewallgroup.py
  14. 2
      neutronclient/tests/unit/osc/v2/fwaas/test_firewallpolicy.py
  15. 2
      neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py
  16. 3
      neutronclient/tests/unit/osc/v2/logging/fakes.py
  17. 2
      neutronclient/tests/unit/osc/v2/logging/test_network_log.py
  18. 2
      neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py
  19. 2
      neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py
  20. 2
      neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py
  21. 2
      neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_router_association.py
  22. 2
      neutronclient/tests/unit/osc/v2/sfc/fakes.py
  23. 2
      neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py
  24. 2
      neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py
  25. 2
      neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py
  26. 2
      neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py
  27. 2
      neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py
  28. 2
      neutronclient/tests/unit/osc/v2/subnet_onboard/test_network_onboard_subnets.py
  29. 2
      neutronclient/tests/unit/osc/v2/trunk/fakes.py
  30. 2
      neutronclient/tests/unit/osc/v2/trunk/test_network_trunk.py
  31. 3
      neutronclient/tests/unit/osc/v2/vpnaas/fakes.py
  32. 2
      neutronclient/tests/unit/osc/v2/vpnaas/test_endpoint_group.py
  33. 2
      neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py
  34. 2
      neutronclient/tests/unit/osc/v2/vpnaas/test_ipsec_site_connection.py
  35. 2
      neutronclient/tests/unit/osc/v2/vpnaas/test_ipsecpolicy.py
  36. 2
      neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py
  37. 2
      neutronclient/tests/unit/test_cli20.py
  38. 2
      neutronclient/tests/unit/test_cli20_address_scope.py
  39. 2
      neutronclient/tests/unit/test_cli20_agentschedulers.py
  40. 2
      neutronclient/tests/unit/test_cli20_network.py
  41. 2
      neutronclient/tests/unit/test_cli20_port.py
  42. 2
      neutronclient/tests/unit/test_cli20_securitygroup.py
  43. 2
      neutronclient/tests/unit/test_cli20_subnet.py
  44. 2
      neutronclient/tests/unit/test_cli20_subnetpool.py
  45. 2
      neutronclient/tests/unit/test_cli20_tag.py
  46. 2
      neutronclient/tests/unit/test_client_extension.py
  47. 2
      neutronclient/tests/unit/test_exceptions.py
  48. 3
      neutronclient/tests/unit/test_name_or_id.py
  49. 2
      neutronclient/tests/unit/test_quota.py
  50. 2
      neutronclient/tests/unit/test_shell.py
  51. 1
      test-requirements.txt

1
lower-constraints.txt

@ -39,7 +39,6 @@ kombu==4.0.0
linecache2==1.0.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==0.6
mox3==0.20.0
msgpack-python==0.4.0

2
neutronclient/tests/unit/bgp/test_cli20_speaker.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0.bgp import speaker as bgp_speaker

2
neutronclient/tests/unit/fw/test_cli20_firewallpolicy.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0.fw import firewallpolicy
from neutronclient import shell

2
neutronclient/tests/unit/lb/test_cli20_healthmonitor.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0.lb import healthmonitor
from neutronclient.tests.unit import test_cli20

2
neutronclient/tests/unit/lb/test_cli20_pool.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0.lb import pool
from neutronclient.tests.unit import test_cli20

2
neutronclient/tests/unit/lb/v2/test_cli20_loadbalancer.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0.lb.v2 import loadbalancer as lb
from neutronclient.tests.unit import test_cli20

2
neutronclient/tests/unit/osc/v2/dynamic_routing/fakes.py

@ -11,9 +11,9 @@
# under the License.
import copy
from unittest import mock
import uuid
import mock
from neutronclient.tests.unit.osc.v2 import fakes

2
neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_dragent.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from unittest import mock
from neutronclient.osc.v2.dynamic_routing import bgp_dragent
from neutronclient.tests.unit.osc.v2.dynamic_routing import fakes

2
neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_peer.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from unittest import mock
from neutronclient.osc.v2.dynamic_routing import bgp_peer
from neutronclient.tests.unit.osc.v2.dynamic_routing import fakes

2
neutronclient/tests/unit/osc/v2/dynamic_routing/test_bgp_speaker.py

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from unittest import mock
from neutronclient.osc.v2.dynamic_routing import bgp_speaker
from neutronclient.tests.unit.osc.v2.dynamic_routing import fakes

2
neutronclient/tests/unit/osc/v2/fakes.py

@ -12,9 +12,9 @@
#
import argparse
from unittest import mock
from cliff import columns as cliff_columns
import mock
from osc_lib.tests import utils

2
neutronclient/tests/unit/osc/v2/fwaas/fakes.py

@ -16,8 +16,8 @@
import collections
import copy
from unittest import mock
import mock
from oslo_utils import uuidutils

2
neutronclient/tests/unit/osc/v2/fwaas/test_firewallgroup.py

@ -16,8 +16,8 @@
import copy
import re
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib.tests import utils

2
neutronclient/tests/unit/osc/v2/fwaas/test_firewallpolicy.py

@ -16,8 +16,8 @@
import copy
import re
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib.tests import utils

2
neutronclient/tests/unit/osc/v2/fwaas/test_firewallrule.py

@ -16,8 +16,8 @@
import copy
import re
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib.tests import utils
import testtools

3
neutronclient/tests/unit/osc/v2/logging/fakes.py

@ -16,10 +16,9 @@
import collections
import copy
from unittest import mock
import uuid
import mock
class FakeLogging(object):

2
neutronclient/tests/unit/osc/v2/logging/test_network_log.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib.tests import utils
import testtools

2
neutronclient/tests/unit/osc/v2/networking_bgpvpn/fakes.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib.utils import columns as column_util
from neutronclient.osc import utils as nc_osc_utils

2
neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_bgpvpn.py

@ -16,8 +16,8 @@
import copy
import operator
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib import utils as osc_utils
from osc_lib.utils import columns as column_util

2
neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_resource_association.py

@ -16,8 +16,8 @@
import copy
import operator
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib import utils as osc_utils
from osc_lib.utils import columns as column_util

2
neutronclient/tests/unit/osc/v2/networking_bgpvpn/test_router_association.py

@ -16,8 +16,8 @@
import copy
import operator
from unittest import mock
import mock
from osc_lib.tests.utils import ParserException
from osc_lib import utils as osc_utils
from osc_lib.utils import columns as column_util

2
neutronclient/tests/unit/osc/v2/sfc/fakes.py

@ -15,8 +15,8 @@
import argparse
import copy
from unittest import mock
import mock
from osc_lib.tests import utils
from oslo_utils import uuidutils

2
neutronclient/tests/unit/osc/v2/sfc/test_flow_classifier.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutronclient.osc.v2.sfc import sfc_flow_classifier
from neutronclient.tests.unit.osc.v2.sfc import fakes

2
neutronclient/tests/unit/osc/v2/sfc/test_port_chain.py

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

2
neutronclient/tests/unit/osc/v2/sfc/test_port_pair.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutronclient.osc.v2.sfc import sfc_port_pair
from neutronclient.tests.unit.osc.v2.sfc import fakes

2
neutronclient/tests/unit/osc/v2/sfc/test_port_pair_group.py

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutronclient.osc.v2.sfc import sfc_port_pair_group
from neutronclient.tests.unit.osc.v2.sfc import fakes

2
neutronclient/tests/unit/osc/v2/sfc/test_service_graph.py

@ -11,8 +11,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import mock
from osc_lib import exceptions
from osc_lib.tests import utils as tests_utils

2
neutronclient/tests/unit/osc/v2/subnet_onboard/test_network_onboard_subnets.py

@ -14,7 +14,7 @@
# under the License.
#
import mock
from unittest import mock
from neutronclient.osc.v2.subnet_onboard import subnet_onboard
from neutronclient.tests.unit.osc.v2 import fakes as test_fakes

2
neutronclient/tests/unit/osc/v2/trunk/fakes.py

@ -11,8 +11,8 @@
# under the License.
import copy
from unittest import mock
import mock
from oslo_utils import uuidutils

2
neutronclient/tests/unit/osc/v2/trunk/test_network_trunk.py

@ -15,8 +15,8 @@
import argparse
import copy
from unittest import mock
import mock
from mock import call
from osc_lib.cli import format_columns
from osc_lib import exceptions

3
neutronclient/tests/unit/osc/v2/vpnaas/fakes.py

@ -16,10 +16,9 @@
import collections
import copy
from unittest import mock
import uuid
import mock
class FakeVPNaaS(object):

2
neutronclient/tests/unit/osc/v2/vpnaas/test_endpoint_group.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib.tests import utils as tests_utils
from neutronclient.osc import utils as osc_utils

2
neutronclient/tests/unit/osc/v2/vpnaas/test_ikepolicy.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib.tests import utils as tests_utils
from neutronclient.osc import utils as osc_utils

2
neutronclient/tests/unit/osc/v2/vpnaas/test_ipsec_site_connection.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib.cli import format_columns
from osc_lib.tests import utils as tests_utils

2
neutronclient/tests/unit/osc/v2/vpnaas/test_ipsecpolicy.py

@ -15,8 +15,8 @@
#
import copy
from unittest import mock
import mock
from osc_lib.tests import utils as tests_utils
from neutronclient.osc import utils as osc_utils

2
neutronclient/tests/unit/osc/v2/vpnaas/test_vpnservice.py

@ -15,9 +15,9 @@
#
import copy
from unittest import mock
import uuid
import mock
from neutronclient.osc import utils as osc_utils
from neutronclient.osc.v2.vpnaas import vpnservice

2
neutronclient/tests/unit/test_cli20.py

@ -18,9 +18,9 @@ import contextlib
from io import StringIO
import itertools
import sys
from unittest import mock
import urllib.parse as urlparse
import mock
from oslo_serialization import jsonutils
from oslo_utils import encodeutils
from oslotest import base

2
neutronclient/tests/unit/test_cli20_address_scope.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0 import address_scope

2
neutronclient/tests/unit/test_cli20_agentschedulers.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0 import agentscheduler
from neutronclient.neutron.v2_0 import network

2
neutronclient/tests/unit/test_cli20_network.py

@ -15,8 +15,8 @@
import itertools
import sys
from unittest import mock
import mock
from oslo_serialization import jsonutils
from neutronclient.common import exceptions

2
neutronclient/tests/unit/test_cli20_port.py

@ -16,8 +16,8 @@
import itertools
import sys
from unittest import mock
import mock
from neutronclient.neutron.v2_0 import port
from neutronclient import shell

2
neutronclient/tests/unit/test_cli20_securitygroup.py

@ -15,9 +15,9 @@
# under the License.
import sys
from unittest import mock
import urllib.parse as urlparse
import mock
from oslo_utils import uuidutils
from neutronclient.common import exceptions

2
neutronclient/tests/unit/test_cli20_subnet.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron import v2_0 as neutronV20

2
neutronclient/tests/unit/test_cli20_subnetpool.py

@ -15,8 +15,8 @@
#
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0 import subnetpool

2
neutronclient/tests/unit/test_cli20_tag.py

@ -11,8 +11,8 @@
# under the License.
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0 import network

2
neutronclient/tests/unit/test_client_extension.py

@ -16,8 +16,8 @@
import inspect
import sys
from unittest import mock
import mock
from neutronclient.common import extension
from neutronclient.neutron.v2_0.contrib import _fox_sockets as fox_sockets

2
neutronclient/tests/unit/test_exceptions.py

@ -13,8 +13,8 @@
# under the License.
import sys
from unittest import mock
import mock
from oslo_utils import encodeutils
import testtools

3
neutronclient/tests/unit/test_name_or_id.py

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

2
neutronclient/tests/unit/test_quota.py

@ -15,8 +15,8 @@
# under the License.
import sys
from unittest import mock
import mock
from neutronclient.common import exceptions
from neutronclient.neutron.v2_0 import quota as test_quota

2
neutronclient/tests/unit/test_shell.py

@ -19,10 +19,10 @@ import logging
import os
import re
import sys
from unittest import mock
import fixtures
from keystoneauth1 import session
import mock
import testtools
from testtools import matchers

1
test-requirements.txt

@ -7,7 +7,6 @@ bandit!=1.6.0,>=1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
flake8-import-order==0.12 # LGPLv3
mock>=2.0.0 # BSD
oslotest>=3.2.0 # Apache-2.0
osprofiler>=2.3.0 # Apache-2.0
python-openstackclient>=3.12.0 # Apache-2.0

Loading…
Cancel
Save