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:
parent
e8b7b3fd0b
commit
18a47cb24a
@ -14,9 +14,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import decimal
|
import decimal
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from keystoneauth1 import session as ks_sess
|
from keystoneauth1 import session as ks_sess
|
||||||
import mock
|
|
||||||
from oslo_config import fixture as config_fixture
|
from oslo_config import fixture as config_fixture
|
||||||
from oslotest import base
|
from oslotest import base
|
||||||
import testscenarios
|
import testscenarios
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty.api.v2.dataframes import dataframes
|
from cloudkitty.api.v2.dataframes import dataframes
|
||||||
from cloudkitty.utils import tz as tzutils
|
from cloudkitty.utils import tz as tzutils
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty.api.v2.summary import summary
|
from cloudkitty.api.v2.summary import summary
|
||||||
from cloudkitty.utils import tz as tzutils
|
from cloudkitty.utils import tz as tzutils
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import flask
|
import flask
|
||||||
import mock
|
|
||||||
import voluptuous
|
import voluptuous
|
||||||
from werkzeug.datastructures import MultiDict
|
from werkzeug.datastructures import MultiDict
|
||||||
from werkzeug.exceptions import BadRequest
|
from werkzeug.exceptions import BadRequest
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import datetime
|
import datetime
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty.collector import gnocchi
|
from cloudkitty.collector import gnocchi
|
||||||
from cloudkitty import tests
|
from cloudkitty import tests
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import datetime
|
import datetime
|
||||||
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty.collector import monasca as mon_collector
|
from cloudkitty.collector import monasca as mon_collector
|
||||||
from cloudkitty import tests
|
from cloudkitty import tests
|
||||||
|
@ -14,8 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty import collector
|
from cloudkitty import collector
|
||||||
from cloudkitty.collector import exceptions
|
from cloudkitty.collector import exceptions
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from cloudkitty.collector import prometheus
|
from cloudkitty.collector import prometheus
|
||||||
from cloudkitty import tests
|
from cloudkitty import tests
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from cloudkitty.common.prometheus_client import PrometheusClient
|
from cloudkitty.common.prometheus_client import PrometheusClient
|
||||||
from cloudkitty.common.prometheus_client import PrometheusResponseError
|
from cloudkitty.common.prometheus_client import PrometheusResponseError
|
||||||
|
@ -18,10 +18,10 @@ import collections
|
|||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
import os
|
import os
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
from gabbi import fixture
|
from gabbi import fixture
|
||||||
import mock
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_config import fixture as conf_fixture
|
from oslo_config import fixture as conf_fixture
|
||||||
from oslo_db.sqlalchemy import utils
|
from oslo_db.sqlalchemy import utils
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from gnocchiclient import exceptions as gexc
|
from gnocchiclient import exceptions as gexc
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#
|
#
|
||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
import testscenarios
|
import testscenarios
|
||||||
|
|
||||||
from cloudkitty import storage
|
from cloudkitty import storage
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
import collections
|
import collections
|
||||||
import datetime
|
import datetime
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty import dataframe
|
from cloudkitty import dataframe
|
||||||
from cloudkitty.storage.v2.elasticsearch import client
|
from cloudkitty.storage.v2.elasticsearch import client
|
||||||
|
@ -17,9 +17,9 @@ import copy
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty import dataframe
|
from cloudkitty import dataframe
|
||||||
from cloudkitty.storage.v2 import influx
|
from cloudkitty.storage.v2 import influx
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import datetime
|
import datetime
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
import testscenarios
|
import testscenarios
|
||||||
|
|
||||||
from cloudkitty import storage
|
from cloudkitty import storage
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
import mock
|
|
||||||
import pep8
|
import pep8
|
||||||
|
|
||||||
from cloudkitty.hacking import checks
|
from cloudkitty.hacking import checks
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
import copy
|
import copy
|
||||||
import datetime
|
import datetime
|
||||||
import decimal
|
import decimal
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from cloudkitty import dataframe
|
from cloudkitty import dataframe
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
|
|
||||||
from cloudkitty.fetcher import keystone
|
from cloudkitty.fetcher import keystone
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import datetime
|
import datetime
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
from oslo_messaging import conffixture
|
from oslo_messaging import conffixture
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
from tooz import coordination
|
from tooz import coordination
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
import copy
|
import copy
|
||||||
import decimal
|
import decimal
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from unittest import mock
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
import mock
|
|
||||||
from oslo_utils import uuidutils
|
from oslo_utils import uuidutils
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
import mock
|
from unittest import mock
|
||||||
|
|
||||||
from cloudkitty.db import api as ck_db_api
|
from cloudkitty.db import api as ck_db_api
|
||||||
from cloudkitty import tests
|
from cloudkitty import tests
|
||||||
|
@ -12,14 +12,10 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
try:
|
from collections import abc
|
||||||
from collections.abc import Iterable
|
|
||||||
except ImportError:
|
|
||||||
from collections import Iterable
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import itertools
|
import itertools
|
||||||
|
from unittest import mock
|
||||||
import mock
|
|
||||||
|
|
||||||
from cloudkitty import storage_state
|
from cloudkitty import storage_state
|
||||||
from cloudkitty import tests
|
from cloudkitty import tests
|
||||||
@ -37,7 +33,7 @@ class StateManagerTest(tests.TestCase):
|
|||||||
def __init__(self, output, *args, **kwargs):
|
def __init__(self, output, *args, **kwargs):
|
||||||
super(StateManagerTest.QueryMock, self).__init__(*args, **kwargs)
|
super(StateManagerTest.QueryMock, self).__init__(*args, **kwargs)
|
||||||
self.first_called = 0
|
self.first_called = 0
|
||||||
if not isinstance(output, Iterable):
|
if not isinstance(output, abc.Iterable):
|
||||||
output = (output, )
|
output = (output, )
|
||||||
self.output = itertools.cycle(output)
|
self.output = itertools.cycle(output)
|
||||||
|
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#
|
#
|
||||||
import datetime
|
import datetime
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
import mock
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from cloudkitty import utils
|
from cloudkitty import utils
|
||||||
|
@ -18,8 +18,8 @@ import decimal
|
|||||||
import fractions
|
import fractions
|
||||||
import itertools
|
import itertools
|
||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import mock
|
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
|
||||||
from cloudkitty import utils as ck_utils
|
from cloudkitty import utils as ck_utils
|
||||||
|
@ -39,7 +39,6 @@ ddt==1.0.1 # MIT
|
|||||||
gabbi==1.26.1 # Apache-2.0
|
gabbi==1.26.1 # Apache-2.0
|
||||||
testscenarios==0.4 # Apache-2.0/BSD
|
testscenarios==0.4 # Apache-2.0/BSD
|
||||||
stestr==2.0.0 # Apache-2.0
|
stestr==2.0.0 # Apache-2.0
|
||||||
mock==1.2 # BSD
|
|
||||||
sphinx==1.8.0 # BSD
|
sphinx==1.8.0 # BSD
|
||||||
openstackdocstheme==1.30.0 # Apache-2.0
|
openstackdocstheme==1.30.0 # Apache-2.0
|
||||||
oslotest==1.10.0 # Apache-2.0
|
oslotest==1.10.0 # Apache-2.0
|
||||||
|
@ -11,7 +11,6 @@ ddt>=1.0.1 # MIT
|
|||||||
gabbi>=1.26.1 # Apache-2.0
|
gabbi>=1.26.1 # Apache-2.0
|
||||||
testscenarios>=0.4 # Apache-2.0/BSD
|
testscenarios>=0.4 # Apache-2.0/BSD
|
||||||
stestr>=2.0.0 # Apache-2.0
|
stestr>=2.0.0 # Apache-2.0
|
||||||
mock>=1.2 # BSD
|
|
||||||
sphinx>=1.8.0,!=2.1.0 # BSD
|
sphinx>=1.8.0,!=2.1.0 # BSD
|
||||||
openstackdocstheme>=1.30.0 # Apache-2.0
|
openstackdocstheme>=1.30.0 # Apache-2.0
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user