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: Ia8fea320d8b09a89c999ace06769436a5335bcc6
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-03-20 15:30:01 -05:00
parent 4e3c12968d
commit 56012eaa5c
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
54 changed files with 100 additions and 103 deletions

View File

@ -13,9 +13,9 @@
# 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 fixtures
import mock
from ceilometer.compute.virt import inspector as virt_inspector
from ceilometer import service

View File

@ -14,7 +14,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ceilometer.compute.pollsters import disk
from ceilometer.compute.virt import inspector as virt_inspector

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ceilometer.compute.pollsters import instance_stats
from ceilometer.compute.virt import inspector as virt_inspector

View File

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ceilometer.compute.pollsters import net
from ceilometer.compute.virt import inspector as virt_inspector

View File

@ -11,10 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
import iso8601
from unittest import mock
import fixtures
import iso8601
import mock
import testtools
try:

View File

@ -16,8 +16,8 @@ Tests for Hyper-V inspector.
"""
import sys
from unittest import mock
import mock
from os_win import exceptions as os_win_exc
from oslo_utils import units
from oslotest import base

View File

@ -11,11 +11,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for libvirt inspector.
"""
"""Tests for libvirt inspector."""
from unittest import mock
import fixtures
import mock
from oslo_utils import units
from oslotest import base

View File

@ -16,7 +16,8 @@
Tests for VMware vSphere inspector.
"""
import mock
from unittest import mock
from oslo_vmware import api
from oslotest import base

View File

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

View File

@ -11,10 +11,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for xenapi inspector.
"""
"""Tests for xenapi inspector."""
from unittest import mock
import mock
from oslotest import base
from ceilometer.compute.virt.xenapi import inspector as xenapi_inspector

View File

@ -14,9 +14,9 @@
# under the License.
import datetime
from unittest import mock
import jsonpath_rw_ext
import mock
import six
from ceilometer import declarative

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for Ceilometer notify daemon."""
from unittest import mock
import fixtures
import mock
import oslo_messaging
from oslo_utils import fileutils
import six

View File

@ -12,10 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py
"""
"""Tests for ceilometer/hardware/inspector/snmp/inspector.py"""
from unittest import mock
import fixtures
import mock
from oslo_utils import netutils
from pysnmp.proto import rfc1905
import six

View File

@ -13,12 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import six
import yaml
from unittest import mock
import fixtures
from oslo_utils import fileutils
import six
import yaml
from ceilometer import declarative
from ceilometer.hardware.inspector import base as inspector_base

View File

@ -12,10 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for producing IPMI sample messages from notification events.
"""
"""Tests for producing IPMI sample messages from notification events."""
from unittest import mock
import mock
from oslotest import base
from ceilometer.ipmi.notifications import ironic as ipmi

View File

@ -14,8 +14,8 @@
import abc
import tempfile
from unittest import mock
import mock
from oslotest import base
import six

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslotest import base
from ceilometer.ipmi.platform import ipmi_sensor

View File

@ -13,9 +13,9 @@
# under the License.
import abc
from unittest import mock
import fixtures
import mock
import six
from ceilometer.polling import manager

View File

@ -12,7 +12,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.
import mock
from unittest import mock
from oslotest import base
from ceilometer.event import trait_plugins

View File

@ -10,16 +10,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer.meter.notifications
"""
"""Tests for ceilometer.meter.notifications"""
import copy
import fixtures
import mock
import six
import yaml
from unittest import mock
import fixtures
from oslo_utils import encodeutils
from oslo_utils import fileutils
import six
import yaml
from ceilometer import declarative
from ceilometer.meter import notifications

View File

@ -12,9 +12,9 @@
# 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 fixtures
import mock
from oslotest import base
from ceilometer.network.services import discovery

View File

@ -12,9 +12,9 @@
# 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 fixtures
import mock
from oslotest import base
from ceilometer.network.services import discovery

View File

@ -11,9 +11,9 @@
# 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 fixtures
import mock
from oslotest import base
from ceilometer.network.services import discovery

View File

@ -12,9 +12,9 @@
# 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 fixtures
import mock
from oslotest import base
from ceilometer.network.services import discovery

View File

@ -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 fixture as config_fixture
from oslotest import base

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslotest import base
from six.moves.urllib import parse as urlparse

View File

@ -12,7 +12,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.
import mock
from unittest import mock
from oslo_config import fixture as config_fixture
from oslotest import base
from requests import auth as req_auth

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import abc
from unittest import mock
import mock
from oslotest import base
import six
from six.moves.urllib import parse as url_parse

View File

@ -13,9 +13,9 @@
# 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 fixtures
import mock
from oslotest import base
from ceilometer.network import floatingip

View File

@ -13,10 +13,10 @@
# under the License.
import collections
from unittest import mock
import fixtures
from keystoneauth1 import exceptions
import mock
from oslotest import base
import testscenarios.testcase

View File

@ -13,8 +13,8 @@
# under the License.
import json
from unittest import mock
import mock
from oslotest import base
from ceilometer.objectstore import rgw_client

View File

@ -13,10 +13,10 @@
# under the License.
import collections
from unittest import mock
import fixtures
from keystoneauth1 import exceptions
import mock
from oslotest import base
from swiftclient import client as swift_client
import testscenarios.testcase

View File

@ -16,9 +16,9 @@
import abc
import traceback
from unittest import mock
import fixtures
import mock
from oslo_utils import timeutils
import six

View File

@ -12,10 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/central/manager.py
"""
"""Tests for ceilometer/central/manager.py"""
from unittest import mock
import mock
from oslotest import base
from ceilometer.hardware import discovery as hardware

View File

@ -11,21 +11,18 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/polling/dynamic_pollster.py
"""
"""Tests for ceilometer/polling/dynamic_pollster.py"""
import copy
import logging
from unittest import mock
from oslotest import base
import requests
from ceilometer.declarative import DynamicPollsterDefinitionException
from ceilometer.polling import dynamic_pollster
from ceilometer import sample
import copy
import logging
import mock
import requests
LOG = logging.getLogger(__name__)

View File

@ -18,9 +18,9 @@
"""Tests for ceilometer agent manager"""
import copy
import datetime
import fixtures
import mock
from unittest import mock
import fixtures
from keystoneauth1 import exceptions as ka_exceptions
from stevedore import extension
@ -34,7 +34,6 @@ from ceilometer.polling import manager
from ceilometer.polling import plugin_base
from ceilometer import sample
from ceilometer import service
from ceilometer.tests import base

View File

@ -11,13 +11,14 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslotest import base
import requests
from ceilometer.polling.discovery.endpoint import EndpointDiscovery
from ceilometer.polling.discovery.non_openstack_credentials_discovery import \
NonOpenStackCredentialsDiscovery
from oslotest import base
class TestNonOpenStackCredentialsDiscovery(base.BaseTestCase):

View File

@ -11,12 +11,12 @@
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/polling/non_openstack_dynamic_pollster.py
"""
"""Tests for ceilometer/polling/non_openstack_dynamic_pollster.py"""
import copy
import sys
from unittest import mock
import mock
from oslotest import base
import requests
from ceilometer.declarative import DynamicPollsterDefinitionException
@ -28,9 +28,6 @@ from ceilometer.polling.dynamic_pollster import \
from ceilometer.polling.dynamic_pollster import PollsterSampleGatherer
from ceilometer.polling.dynamic_pollster import SingleMetricPollsterDefinitions
from oslotest import base
REQUIRED_POLLSTER_FIELDS = ['name', 'sample_type', 'unit', 'value_attribute',
'url_path', 'module', 'authentication_object']

View File

@ -14,12 +14,12 @@
# under the License.
import os
from unittest import mock
import uuid
import fixtures
from gnocchiclient import exceptions as gnocchi_exc
from keystoneauth1 import exceptions as ka_exceptions
import mock
from oslo_config import fixture as config_fixture
from oslo_utils import fileutils
from oslo_utils import fixture as utils_fixture

View File

@ -12,15 +12,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/publisher/http.py
"""
"""Tests for ceilometer/publisher/http.py"""
import datetime
import mock
from unittest import mock
import uuid
from oslotest import base
import requests
from six.moves.urllib import parse as urlparse
import uuid
from ceilometer.event import models as event
from ceilometer.publisher import http

View File

@ -12,12 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/publisher/messaging.py
"""
"""Tests for ceilometer/publisher/messaging.py"""
import datetime
from unittest import mock
import uuid
import mock
import oslo_messaging
from oslo_messaging._drivers import impl_kafka as kafka_driver
from oslo_utils import netutils

View File

@ -15,7 +15,8 @@
# under the License.
import datetime
import mock
from unittest import mock
from oslo_utils import timeutils
from oslotest import base

View File

@ -13,14 +13,13 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/publisher/monasca.py
"""
"""Tests for ceilometer/publisher/monasca.py"""
import datetime
import fixtures
import time
from unittest import mock
import mock
from oslotest import base
from ceilometer import monasca_client as mon_client

View File

@ -12,15 +12,15 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/publisher/prometheus.py
"""
"""Tests for ceilometer/publisher/prometheus.py"""
import datetime
import mock
from unittest import mock
import uuid
from oslotest import base
import requests
from six.moves.urllib import parse as urlparse
import uuid
from ceilometer.publisher import prometheus
from ceilometer import sample

View File

@ -12,12 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Tests for ceilometer/publisher/udp.py
"""
"""Tests for ceilometer/publisher/udp.py"""
import datetime
from unittest import mock
import mock
import msgpack
from oslo_utils import netutils
from oslotest import base

View File

@ -12,10 +12,11 @@
# under the License.
import datetime
import mock
from unittest import mock
import uuid
from oslotest import base
from six.moves.urllib import parse as urlparse
import uuid
from ceilometer.event import models as event
from ceilometer.publisher import zaqar

View File

@ -12,9 +12,9 @@
# 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 fixtures
import mock
from ceilometer import declarative
from ceilometer.tests import base

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ceilometer import middleware
from ceilometer import service

View File

@ -12,17 +12,16 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from monascaclient import exc
from oslo_utils import netutils
from oslotest import base
import tenacity
from ceilometer import monasca_client
from ceilometer import service
from monascaclient import exc
import tenacity
class TestMonascaClient(base.BaseTestCase):
def setUp(self):

View File

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

View File

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutronclient.v2_0 import client
from oslotest import base

View File

@ -15,8 +15,8 @@
"""Tests for Ceilometer notify daemon."""
import time
from unittest import mock
import mock
from oslo_utils import fileutils
import six
import yaml

View File

@ -11,10 +11,10 @@
# 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 fixtures
import glanceclient
import mock
import novaclient
from oslotest import base

View File

@ -4,7 +4,6 @@
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
os-win>=3.0.0 # Apache-2.0
oslo.messaging[kafka]>=6.2.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0