Merge "Use unittest.mock instead of third party lib"

This commit is contained in:
Zuul 2020-07-16 19:24:11 +00:00 committed by Gerrit Code Review
commit 9881dfc77c
39 changed files with 79 additions and 48 deletions

View File

@ -30,7 +30,6 @@ jsonschema==2.6.0
keystoneauth1==3.4.0 keystoneauth1==3.4.0
linecache2==1.0.0 linecache2==1.0.0
MarkupSafe==1.0 MarkupSafe==1.0
mock==2.0.0
monotonic==0.6 monotonic==0.6
msgpack-python==0.4.0 msgpack-python==0.4.0
munch==2.1.0 munch==2.1.0
@ -85,3 +84,8 @@ unittest2==1.1.0
urllib3==1.21.1 urllib3==1.21.1
warlock==1.2.0 warlock==1.2.0
wrapt==1.7.0 wrapt==1.7.0
# Can be removed in Victoria cycle, when we raise the requirement of
# python-openstackclient in test-requirements to a version that no longer
# requires mock. See: https://review.opendev.org/#/c/717410/
mock==2.0.0

View File

@ -10,9 +10,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 ddt
import mock
import re import re
from unittest import mock
import ddt
import requests import requests
import manilaclient import manilaclient

View File

@ -13,11 +13,11 @@
# under the License. # under the License.
# #
import mock
from oslo_serialization import jsonutils
import sys import sys
from unittest import mock
from keystoneauth1 import fixture from keystoneauth1 import fixture
from oslo_serialization import jsonutils
import requests import requests
AUTH_TOKEN = "foobar" AUTH_TOKEN = "foobar"

View File

@ -13,8 +13,8 @@
import copy import copy
import datetime import datetime
import mock
import random import random
from unittest import mock
import uuid import uuid
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes

View File

@ -14,11 +14,9 @@
# #
import argparse import argparse
import mock from unittest import mock
import uuid import uuid
from mock import call
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
from osc_lib import exceptions from osc_lib import exceptions
@ -190,7 +188,7 @@ class TestShareDelete(TestShare):
result = self.cmd.take_action(parsed_args) result = self.cmd.take_action(parsed_args)
calls = [call(s, None) for s in shares] calls = [mock.call(s, None) for s in shares]
self.shares_mock.delete.assert_has_calls(calls) self.shares_mock.delete.assert_has_calls(calls)
self.assertIsNone(result) self.assertIsNone(result)

View File

@ -11,7 +11,7 @@
# under the License. # under the License.
# #
from mock import call from unittest import mock
from osc_lib import exceptions from osc_lib import exceptions
from osc_lib import utils as oscutils from osc_lib import utils as oscutils
@ -278,7 +278,7 @@ class TestShareTypeDelete(TestShareType):
calls = [] calls = []
for t in self.share_types: for t in self.share_types:
calls.append(call(t)) calls.append(mock.call(t))
self.shares_mock.delete.assert_has_calls(calls) self.shares_mock.delete.assert_has_calls(calls)
self.assertIsNone(result) self.assertIsNone(result)

View File

@ -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 ddt import ddt
import mock
import six import six
import manilaclient import manilaclient

View File

@ -9,7 +9,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.
from mock import mock
from unittest import mock
from manilaclient.common.apiclient import base as common_base from manilaclient.common.apiclient import base as common_base
from manilaclient import exceptions from manilaclient import exceptions

View File

@ -10,8 +10,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 ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import client from manilaclient import client

View File

@ -12,10 +12,10 @@
import re import re
import sys import sys
from unittest import mock
import ddt import ddt
import fixtures import fixtures
import mock
from six import moves from six import moves
from tempest.lib.cli import output_parser from tempest.lib.cli import output_parser
from testtools import matchers from testtools import matchers

View File

@ -11,9 +11,9 @@
# under the License. # under the License.
import os import os
from unittest import mock
import fixtures import fixtures
import mock
import requests import requests
import testtools import testtools

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -10,15 +10,15 @@
# 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 ddt import ddt
import mock from oslo_utils import uuidutils
import manilaclient import manilaclient
from manilaclient import exceptions from manilaclient import exceptions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.v2 import client from manilaclient.v2 import client
from oslo_utils import uuidutils
@ddt.ddt @ddt.ddt

View File

@ -13,8 +13,9 @@
# 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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.v2 import limits from manilaclient.v2 import limits

View File

@ -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
import ddt import ddt
import six import six

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

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 manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.tests.unit.v2 import fakes from manilaclient.tests.unit.v2 import fakes

View File

@ -12,7 +12,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
from unittest import mock
from manilaclient import exceptions from manilaclient import exceptions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import extension from manilaclient import extension

View File

@ -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
import ddt import ddt
import six import six

View File

@ -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
import ddt import ddt
import six import six

View File

@ -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
import ddt import ddt
import six import six

View File

@ -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
import ddt import ddt
import six import six

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import extension from manilaclient import extension

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import extension from manilaclient import extension

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils
from manilaclient.tests.unit.v2 import fakes from manilaclient.tests.unit.v2 import fakes

View File

@ -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.
import ddt
import itertools import itertools
import mock from unittest import mock
import ddt
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import exceptions from manilaclient import exceptions

View File

@ -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 ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -12,8 +12,10 @@
# 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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient.common.apiclient import base as common_base from manilaclient.common.apiclient import base as common_base
from manilaclient.common import constants from manilaclient.common import constants

View File

@ -13,8 +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.
from unittest import mock
import ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import exceptions from manilaclient import exceptions

View File

@ -15,8 +15,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 ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import extension from manilaclient import extension

View File

@ -15,8 +15,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 ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.common.apiclient import exceptions as client_exceptions from manilaclient.common.apiclient import exceptions as client_exceptions

View File

@ -15,10 +15,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.
import itertools
from unittest import mock
import ddt import ddt
import fixtures import fixtures
import itertools
import mock
from oslo_utils import strutils from oslo_utils import strutils
import six import six

View File

@ -14,8 +14,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 ddt import ddt
import mock
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient.tests.unit import utils from manilaclient.tests.unit import utils

View File

@ -12,9 +12,10 @@
# limitations under the License. # limitations under the License.
import copy import copy
import ddt
import itertools import itertools
import mock from unittest import mock
import ddt
from manilaclient import api_versions from manilaclient import api_versions
from manilaclient import config from manilaclient import config

View File

@ -8,8 +8,12 @@ hacking>=3.0.1,<3.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT ddt>=1.0.1 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
# Can be removed in Victoria cycle, when we raise the requirement of
# python-openstackclient in this file to a version that no longer
# requires mock. See: https://review.opendev.org/717410/
mock>=2.0.0 # BSD mock>=2.0.0 # BSD
os-testr>=1.0.0 # Apache-2.0 os-testr>=1.0.0 # Apache-2.0
tempest>=17.1.0 # Apache-2.0 tempest>=17.1.0 # Apache-2.0
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
python-openstackclient>=3.12.0 # Apache-2.0 python-openstackclient>=3.12.0 # Apache-2.0