Use unittest.mock instead of third party mock

We can now use the standard library mock library instead of the third
party one previously needed for py27 compatibility.

Change-Id: Ia8e87cd6a25621a97c876de5422d0c9d0c8dd751
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-03-27 15:47:29 -05:00 committed by Pierre Riteau
parent e8b7b3fd0b
commit 18a47cb24a
26 changed files with 27 additions and 36 deletions

View File

@ -14,9 +14,9 @@
# under the License.
#
import decimal
from unittest import mock
from keystoneauth1 import session as ks_sess
import mock
from oslo_config import fixture as config_fixture
from oslotest import base
import testscenarios

View File

@ -13,8 +13,7 @@
# under the License.
#
import unittest
import mock
from unittest import mock
from cloudkitty.api.v2.dataframes import dataframes
from cloudkitty.utils import tz as tzutils

View File

@ -13,8 +13,7 @@
# under the License.
#
import unittest
import mock
from unittest import mock
from cloudkitty.api.v2.summary import summary
from cloudkitty.utils import tz as tzutils

View File

@ -12,8 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import flask
import mock
import voluptuous
from werkzeug.datastructures import MultiDict
from werkzeug.exceptions import BadRequest

View File

@ -14,9 +14,9 @@
# under the License.
#
import datetime
from unittest import mock
from dateutil import tz
import mock
from cloudkitty.collector import gnocchi
from cloudkitty import tests

View File

@ -13,8 +13,7 @@
# under the License.
#
import datetime
import mock
from unittest import mock
from cloudkitty.collector import monasca as mon_collector
from cloudkitty import tests

View File

@ -14,8 +14,7 @@
# under the License.
#
from decimal import Decimal
import mock
from unittest import mock
from cloudkitty import collector
from cloudkitty.collector import exceptions

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 cloudkitty.collector import prometheus
from cloudkitty import tests

View File

@ -14,7 +14,7 @@
# under the License.
#
#
import mock
from unittest import mock
from cloudkitty.common.prometheus_client import PrometheusClient
from cloudkitty.common.prometheus_client import PrometheusResponseError

View File

@ -18,10 +18,10 @@ import collections
import datetime
import decimal
import os
from unittest import mock
from dateutil import tz
from gabbi import fixture
import mock
from oslo_config import cfg
from oslo_config import fixture as conf_fixture
from oslo_db.sqlalchemy import utils

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 gnocchiclient import exceptions as gexc

View File

@ -15,8 +15,8 @@
#
import copy
import datetime
from unittest import mock
import mock
import testscenarios
from cloudkitty import storage

View File

@ -15,9 +15,9 @@
import collections
import datetime
import unittest
from unittest import mock
from dateutil import tz
import mock
from cloudkitty import dataframe
from cloudkitty.storage.v2.elasticsearch import client

View File

@ -17,9 +17,9 @@ import copy
from datetime import datetime
from datetime import timedelta
import unittest
from unittest import mock
from dateutil import tz
import mock
from cloudkitty import dataframe
from cloudkitty.storage.v2 import influx

View File

@ -13,8 +13,8 @@
# under the License.
#
import datetime
from unittest import mock
import mock
import testscenarios
from cloudkitty import storage

View File

@ -14,9 +14,9 @@
import sys
import textwrap
from unittest import mock
import ddt
import mock
import pep8
from cloudkitty.hacking import checks

View File

@ -16,8 +16,8 @@
import copy
import datetime
import decimal
from unittest import mock
import mock
from oslo_utils import uuidutils
from cloudkitty import dataframe

View File

@ -14,8 +14,8 @@
# under the License.
#
import unittest
from unittest import mock
import mock
from oslo_utils import uuidutils
from cloudkitty.fetcher import keystone

View File

@ -14,8 +14,8 @@
# under the License.
#
import datetime
from unittest import mock
import mock
from oslo_messaging import conffixture
from stevedore import extension
from tooz import coordination

View File

@ -16,9 +16,9 @@
import copy
import decimal
import hashlib
from unittest import mock
import zlib
import mock
from oslo_utils import uuidutils
import six

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 cloudkitty.db import api as ck_db_api
from cloudkitty import tests

View File

@ -12,14 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
#
try:
from collections.abc import Iterable
except ImportError:
from collections import Iterable
from collections import abc
from datetime import datetime
import itertools
import mock
from unittest import mock
from cloudkitty import storage_state
from cloudkitty import tests
@ -37,7 +33,7 @@ class StateManagerTest(tests.TestCase):
def __init__(self, output, *args, **kwargs):
super(StateManagerTest.QueryMock, self).__init__(*args, **kwargs)
self.first_called = 0
if not isinstance(output, Iterable):
if not isinstance(output, abc.Iterable):
output = (output, )
self.output = itertools.cycle(output)

View File

@ -14,9 +14,9 @@
#
import datetime
import unittest
from unittest import mock
from dateutil import tz
import mock
from oslo_utils import timeutils
from cloudkitty import utils

View File

@ -18,8 +18,8 @@ import decimal
import fractions
import itertools
import unittest
from unittest import mock
import mock
from oslo_utils import timeutils
from cloudkitty import utils as ck_utils

View File

@ -39,7 +39,6 @@ ddt==1.0.1 # MIT
gabbi==1.26.1 # Apache-2.0
testscenarios==0.4 # Apache-2.0/BSD
stestr==2.0.0 # Apache-2.0
mock==1.2 # BSD
sphinx==1.8.0 # BSD
openstackdocstheme==1.30.0 # Apache-2.0
oslotest==1.10.0 # Apache-2.0

View File

@ -11,7 +11,6 @@ ddt>=1.0.1 # MIT
gabbi>=1.26.1 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
stestr>=2.0.0 # Apache-2.0
mock>=1.2 # BSD
sphinx>=1.8.0,!=2.1.0 # BSD
openstackdocstheme>=1.30.0 # Apache-2.0
oslotest>=1.10.0 # Apache-2.0