Use "unittest.mock" library and drop "mock" installation

As commented in [1], "unittest.mock" has been supported in the Python
internal unit testing framework since version 3.3.

[1]http://lists.openstack.org/pipermail/openstack-discuss/2020-March/013281.html

Change-Id: If71241a412ecfe3471a472802e18c986bd05d5b1
This commit is contained in:
Rodolfo Alonso Hernandez
2020-03-12 17:16:13 +00:00
parent 7798139ffc
commit 1da279b3ad
27 changed files with 31 additions and 30 deletions

View File

@@ -3,4 +3,3 @@ sphinx!=1.6.6,!=1.6.7,>=1.6.2;python_version>='3.4' # BSD
openstackdocstheme>=1.18.1 # Apache-2.0 openstackdocstheme>=1.18.1 # Apache-2.0
os-api-ref>=1.4.0 # Apache-2.0 os-api-ref>=1.4.0 # Apache-2.0
reno>=2.5.0 # Apache-2.0 reno>=2.5.0 # Apache-2.0
mock>=2.0.0 # BSD

View File

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

View File

@@ -11,10 +11,10 @@
# under the License. # under the License.
import copy import copy
from unittest import mock
import warnings import warnings
import fixtures import fixtures
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import enginefacade
from oslo_db.sqlalchemy import provision from oslo_db.sqlalchemy import provision

View File

@@ -17,9 +17,9 @@ import logging as std_logging
import os import os
import os.path import os.path
import random import random
from unittest import mock
import fixtures import fixtures
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_db import options as db_options from oslo_db import options as db_options
from oslo_utils import strutils from oslo_utils import strutils

View File

@@ -13,7 +13,8 @@
# 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
import netaddr import netaddr
import testtools import testtools

View File

@@ -10,7 +10,8 @@
# 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 oslo_config import cfg from oslo_config import cfg
from webob import exc from webob import exc

View File

@@ -10,7 +10,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 neutron_lib.api.validators import availability_zone as az_validator from neutron_lib.api.validators import availability_zone as az_validator
from neutron_lib.db import constants as db_const from neutron_lib.db import constants as db_const

View File

@@ -10,7 +10,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 neutron_lib.api.validators import dns from neutron_lib.api.validators import dns
from neutron_lib.db import constants as db_constants from neutron_lib.db import constants as db_constants

View File

@@ -12,8 +12,8 @@
# under the License. # under the License.
import string import string
from unittest import mock
import mock
import netaddr import netaddr
from neutron_lib._i18n import _ from neutron_lib._i18n import _

View File

@@ -10,7 +10,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 neutron_lib.callbacks import events from neutron_lib.callbacks import events
from oslotest import base from oslotest import base

View File

@@ -12,7 +12,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 oslo_db import exception as db_exc from oslo_db import exception as db_exc
from oslotest import base from oslotest import base

View File

@@ -12,10 +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.
import mock from unittest import mock
import testtools
from oslotest import base from oslotest import base
import testtools
from neutron_lib.callbacks import events from neutron_lib.callbacks import events
from neutron_lib.callbacks import priority_group from neutron_lib.callbacks import priority_group

View File

@@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_db import exception as db_exc from oslo_db import exception as db_exc
import osprofiler import osprofiler
import sqlalchemy import sqlalchemy

View File

@@ -10,7 +10,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 neutron_lib.db import model_query from neutron_lib.db import model_query
from neutron_lib import fixture from neutron_lib import fixture

View File

@@ -10,7 +10,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 oslo_db.sqlalchemy import models from oslo_db.sqlalchemy import models
import sqlalchemy as sa import sqlalchemy as sa

View File

@@ -10,7 +10,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 neutron_lib.objects import utils as obj_utils from neutron_lib.objects import utils as obj_utils
from neutron_lib.tests import _base as base from neutron_lib.tests import _base as base

View File

@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import exceptions as ks_exc
from keystoneauth1 import loading as keystone from keystoneauth1 import loading as keystone

View File

@@ -13,8 +13,8 @@
# under the License. # under the License.
import hashlib import hashlib
from unittest import mock
import mock
from oslo_utils import excutils from oslo_utils import excutils
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron_lib import context from neutron_lib import context
from neutron_lib.policy import _engine as policy_engine from neutron_lib.policy import _engine as policy_engine

View File

@@ -12,7 +12,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 neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings
from neutron_lib import constants from neutron_lib import constants

View File

@@ -10,7 +10,8 @@
# 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 oslo_context import context as oslo_context from oslo_context import context as oslo_context
from testtools import matchers from testtools import matchers

View File

@@ -11,8 +11,8 @@
# under the License. # under the License.
import re import re
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_db import options from oslo_db import options
from oslotest import base from oslotest import base

View File

@@ -10,7 +10,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 oslo_config import cfg from oslo_config import cfg
import oslo_messaging as messaging import oslo_messaging as messaging

View File

@@ -12,7 +12,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 neutron_lib.callbacks import events from neutron_lib.callbacks import events
from neutron_lib.callbacks import resources from neutron_lib.callbacks import resources

View File

@@ -12,8 +12,7 @@
# limitations under the License. # limitations under the License.
import multiprocessing import multiprocessing
from unittest import mock
import mock
from neutron_lib.tests import _base as base from neutron_lib.tests import _base as base
from neutron_lib.utils import host from neutron_lib.utils import host

View File

@@ -14,8 +14,7 @@
import itertools import itertools
import random import random
import socket import socket
from unittest import mock
import mock
from neutron_lib import constants from neutron_lib import constants
from neutron_lib.tests import _base as base from neutron_lib.tests import _base as base

View File

@@ -11,7 +11,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from stevedore import enabled from stevedore import enabled
from neutron_lib.tests import _base as base from neutron_lib.tests import _base as base