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: I1bae5d2d97304b81588ce059916326e1117136e3 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com> Co-Authored-By: Hiroo Kitamura <hiroo.kitamura@ntt-at.co.jp>
This commit is contained in:

committed by
Hiroo Kitamura

parent
c7b5925451
commit
1825b5c509
@@ -13,9 +13,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.
|
||||||
|
|
||||||
import mock
|
|
||||||
from requests_mock.contrib import fixture as requests_mock_fixture
|
from requests_mock.contrib import fixture as requests_mock_fixture
|
||||||
import testtools
|
import testtools
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from cliff import columns as cliff_columns
|
from cliff import columns as cliff_columns
|
||||||
|
|
||||||
|
@@ -18,9 +18,9 @@ import os
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
import mock
|
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
from io import StringIO
|
from io import StringIO
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
import mock
|
|
||||||
from oslo_utils.fixture import uuidsentinel
|
from oslo_utils.fixture import uuidsentinel
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
@@ -15,8 +15,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ast
|
import ast
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
|
@@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
|
from unittest import mock
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from keystoneclient import exceptions as k_exceptions
|
from keystoneclient import exceptions as k_exceptions
|
||||||
import mock
|
|
||||||
import requests
|
import requests
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
@@ -14,11 +14,11 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import fixtures
|
import fixtures
|
||||||
import mock
|
|
||||||
import six
|
import six
|
||||||
import six.moves.urllib.parse as urlparse
|
import six.moves.urllib.parse as urlparse
|
||||||
import sys
|
import sys
|
||||||
|
@@ -13,8 +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
|
|
||||||
import testtools
|
import testtools
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from tackerclient.client import HTTPClient
|
from tackerclient.client import HTTPClient
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
|
@@ -17,12 +17,13 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import six
|
import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
from keystoneclient import session
|
from keystoneclient import session
|
||||||
import mock
|
|
||||||
import testtools
|
import testtools
|
||||||
from testtools import matchers
|
from testtools import matchers
|
||||||
|
|
||||||
|
@@ -13,9 +13,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.
|
||||||
|
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
from keystoneclient import session
|
from keystoneclient import session
|
||||||
import mock
|
|
||||||
import requests
|
import requests
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
|
@@ -13,8 +13,8 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# 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
|
|
||||||
import sys
|
import sys
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
from tackerclient.common import utils
|
from tackerclient.common import utils
|
||||||
|
@@ -14,13 +14,13 @@
|
|||||||
# 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 mock import mock_open
|
|
||||||
from mock import patch
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from tackerclient.common.exceptions import InvalidInput
|
from tackerclient.common.exceptions import InvalidInput
|
||||||
from tackerclient.tacker.v1_0.vnfm import vnfd
|
from tackerclient.tacker.v1_0.vnfm import vnfd
|
||||||
from tackerclient.tests.unit import test_cli10
|
from tackerclient.tests.unit import test_cli10
|
||||||
|
from unittest.mock import mock_open
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
|
||||||
class CLITestV10VmVNFDJSON(test_cli10.CLITestV10Base):
|
class CLITestV10VmVNFDJSON(test_cli10.CLITestV10Base):
|
||||||
|
@@ -10,12 +10,12 @@
|
|||||||
# 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 mock import mock_open
|
|
||||||
from mock import patch
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from tackerclient.tacker.v1_0.nfvo import vnffgd
|
from tackerclient.tacker.v1_0.nfvo import vnffgd
|
||||||
from tackerclient.tests.unit import test_cli10
|
from tackerclient.tests.unit import test_cli10
|
||||||
|
from unittest.mock import mock_open
|
||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
|
||||||
class CLITestV10VmVNFFGDJSON(test_cli10.CLITestV10Base):
|
class CLITestV10VmVNFFGDJSON(test_cli10.CLITestV10Base):
|
||||||
|
@@ -13,12 +13,11 @@
|
|||||||
# 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 mock import sentinel
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from tackerclient.common import exceptions
|
from tackerclient.common import exceptions
|
||||||
from tackerclient.tacker.v1_0.nfvo import vim_utils
|
from tackerclient.tacker.v1_0.nfvo import vim_utils
|
||||||
|
from unittest.mock import sentinel
|
||||||
|
|
||||||
|
|
||||||
class TestVIMUtils(testtools.TestCase):
|
class TestVIMUtils(testtools.TestCase):
|
||||||
|
@@ -10,4 +10,3 @@ python-subunit>=1.0.0 # Apache-2.0/BSD
|
|||||||
requests-mock>=1.2.0 # Apache-2.0
|
requests-mock>=1.2.0 # Apache-2.0
|
||||||
stestr>=2.0.0 # Apache-2.0
|
stestr>=2.0.0 # Apache-2.0
|
||||||
testtools>=2.2.0 # MIT
|
testtools>=2.2.0 # MIT
|
||||||
mock>=2.0.0 # BSD
|
|
||||||
|
Reference in New Issue
Block a user