diff --git a/test-requirements.txt b/test-requirements.txt index e6fd2ab6..a85f92ec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -12,7 +12,6 @@ python-subunit>=0.0.18 oslotest>=1.2.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 testscenarios>=0.4 -mock>=2.0 # BSD testtools>=0.9.36,!=1.2.0 python-swiftclient>=3.1.0 python-keystoneclient diff --git a/tests/unit/agent/common/test_server.py b/tests/unit/agent/common/test_server.py index b54ba2c1..81993d1a 100644 --- a/tests/unit/agent/common/test_server.py +++ b/tests/unit/agent/common/test_server.py @@ -12,9 +12,9 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock import json import unittest +from unittest import mock from storlets.sbus import command as sbus_cmd from storlets.sbus.file_description import SBUS_FD_SERVICE_OUT diff --git a/tests/unit/agent/daemon/test_server.py b/tests/unit/agent/daemon/test_server.py index 43d9d5b9..4ecd82fa 100644 --- a/tests/unit/agent/daemon/test_server.py +++ b/tests/unit/agent/daemon/test_server.py @@ -12,8 +12,8 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock import unittest +from unittest import mock from storlets.sbus import command as sbus_cmd from storlets.agent.daemon.server import StorletDaemon, StorletDaemonLoadError diff --git a/tests/unit/agent/daemon_factory/test_server.py b/tests/unit/agent/daemon_factory/test_server.py index 873cd1f3..ad1f780a 100644 --- a/tests/unit/agent/daemon_factory/test_server.py +++ b/tests/unit/agent/daemon_factory/test_server.py @@ -14,8 +14,8 @@ # limitations under the License. from contextlib import contextmanager import errno -import mock import unittest +from unittest import mock from storlets.sbus import command as sbus_cmd from storlets.sbus.client import SBusResponse diff --git a/tests/unit/gateway/common/test_stob.py b/tests/unit/gateway/common/test_stob.py index ac5d5080..189ca89a 100644 --- a/tests/unit/gateway/common/test_stob.py +++ b/tests/unit/gateway/common/test_stob.py @@ -14,10 +14,11 @@ # limitations under the License. from contextlib import contextmanager -import mock import os import tempfile import unittest +from unittest import mock + from storlets.gateway.common.stob import FileDescriptorIterator diff --git a/tests/unit/gateway/gateways/docker/test_gateway.py b/tests/unit/gateway/gateways/docker/test_gateway.py index d187d707..a5fbb98f 100644 --- a/tests/unit/gateway/gateways/docker/test_gateway.py +++ b/tests/unit/gateway/gateways/docker/test_gateway.py @@ -13,16 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +import eventlet +from io import BytesIO, StringIO +import json import os import os.path from shutil import rmtree from tempfile import mkdtemp -import eventlet -import json -from io import BytesIO, StringIO - -import mock import unittest +from unittest import mock from swift.common.swob import Request, Response from swift.common.utils import FileLikeIter diff --git a/tests/unit/gateway/gateways/docker/test_runtime.py b/tests/unit/gateway/gateways/docker/test_runtime.py index c2dc0436..d55b1686 100644 --- a/tests/unit/gateway/gateways/docker/test_runtime.py +++ b/tests/unit/gateway/gateways/docker/test_runtime.py @@ -13,19 +13,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock -import os -import unittest -import tempfile -import errno from contextlib import contextmanager +import errno from io import StringIO +import os from stat import ST_MODE +import tempfile +import unittest +from unittest import mock + import docker.client import docker.errors import docker.models.containers - from storlets.sbus.client import SBusResponse from storlets.sbus.client.exceptions import SBusClientIOError, \ SBusClientMalformedResponse, SBusClientSendError diff --git a/tests/unit/sbus/client/test_client.py b/tests/unit/sbus/client/test_client.py index b55f9cf3..f6e4eb77 100644 --- a/tests/unit/sbus/client/test_client.py +++ b/tests/unit/sbus/client/test_client.py @@ -13,12 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +from contextlib import contextmanager +import errno import json -import mock import os import unittest -import errno -from contextlib import contextmanager +from unittest import mock from storlets.sbus.client.exceptions import SBusClientSendError, \ SBusClientMalformedResponse diff --git a/tests/unit/swift_middleware/handlers/__init__.py b/tests/unit/swift_middleware/handlers/__init__.py index 4e785855..c0d8faf6 100644 --- a/tests/unit/swift_middleware/handlers/__init__.py +++ b/tests/unit/swift_middleware/handlers/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import unittest +from unittest import mock from storlets.gateway.gateways.stub import StorletGatewayStub from storlets.swift_middleware import storlet_handler diff --git a/tests/unit/swift_middleware/handlers/test_base.py b/tests/unit/swift_middleware/handlers/test_base.py index 916bc3cc..3ef24897 100644 --- a/tests/unit/swift_middleware/handlers/test_base.py +++ b/tests/unit/swift_middleware/handlers/test_base.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock -import unittest from contextlib import contextmanager from io import StringIO +import unittest +from unittest import mock from swift.common.swob import Request from storlets.gateway.common.exceptions import FileManagementError diff --git a/tests/unit/swift_middleware/handlers/test_obj.py b/tests/unit/swift_middleware/handlers/test_obj.py index c118d590..4d23851c 100644 --- a/tests/unit/swift_middleware/handlers/test_obj.py +++ b/tests/unit/swift_middleware/handlers/test_obj.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import unittest +from unittest import mock from swift.common.swob import Request, HTTPOk, HTTPCreated from storlets.swift_middleware.handlers import StorletObjectHandler diff --git a/tests/unit/swift_middleware/handlers/test_proxy.py b/tests/unit/swift_middleware/handlers/test_proxy.py index a4075ed7..60e6a8cb 100644 --- a/tests/unit/swift_middleware/handlers/test_proxy.py +++ b/tests/unit/swift_middleware/handlers/test_proxy.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock -import unittest import itertools +import unittest +from unittest import mock from contextlib import contextmanager from swift.common.swob import Request, HTTPOk, HTTPCreated, HTTPAccepted, \ diff --git a/tests/unit/tools/extensions/test_ipython.py b/tests/unit/tools/extensions/test_ipython.py index 5dd6fa9f..26c82a2e 100644 --- a/tests/unit/tools/extensions/test_ipython.py +++ b/tests/unit/tools/extensions/test_ipython.py @@ -14,13 +14,14 @@ # limitations under the License. from IPython.core.error import UsageError +import itertools from io import FileIO as file from io import StringIO -from storlets.tools.extensions.ipython import StorletMagics -import unittest -import mock import os -import itertools +import unittest +from unittest import mock + +from storlets.tools.extensions.ipython import StorletMagics class FakeConnection(object): diff --git a/tests/unit/tools/test_deploy_storlet.py b/tests/unit/tools/test_deploy_storlet.py index 245ee333..e971a342 100644 --- a/tests/unit/tools/test_deploy_storlet.py +++ b/tests/unit/tools/test_deploy_storlet.py @@ -14,7 +14,7 @@ # limitations under the License. import unittest -import mock +from unittest import mock from storlets.tools.deploy_storlet import main