Skip to content

Commit

Permalink
Move to unittest mock imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt committed Sep 21, 2021
1 parent 25de3bd commit 7019ae7
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 28 deletions.
6 changes: 2 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import shutil
import string
import tempfile
import unittest
from unittest import mock

try:
import unittest2 as unittest
except ImportError:
import unittest
import botocore.session
from botocore.stub import Stubber
from botocore.compat import six
Expand Down
7 changes: 3 additions & 4 deletions tests/functional/test_crt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import mock
import unittest
import threading
import re
from concurrent.futures import Future
Expand All @@ -20,8 +18,9 @@

from s3transfer.subscribers import BaseSubscriber

from tests import FileCreator
from tests import requires_crt, HAS_CRT
from tests import (
FileCreator, requires_crt, HAS_CRT, unittest, mock
)

if HAS_CRT:
import s3transfer.crt
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# language governing permissions and limitations under the License.
from io import BytesIO
from botocore.awsrequest import create_request_object
import mock

from tests import mock
from tests import skip_if_using_serial_implementation
from tests import StubbedClientTest
from s3transfer.exceptions import CancelledError
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_processpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import os
from multiprocessing.managers import BaseManager

import mock
import botocore.exceptions
import botocore.session
from botocore.stub import Stubber

from tests import mock
from tests import unittest
from tests import FileCreator
from s3transfer.compat import six
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import tempfile
import shutil

import mock
from botocore.client import Config
from botocore.exceptions import ClientError
from botocore.awsrequest import AWSRequest
Expand All @@ -25,6 +24,7 @@
from tests import RecordingSubscriber
from tests import RecordingOSUtils
from tests import NonSeekableReader
from tests import mock
from s3transfer.compat import six
from s3transfer.manager import TransferManager
from s3transfer.manager import TransferConfig
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/test_bandwidth.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
import shutil
import tempfile

import mock

from tests import unittest
from tests import mock, unittest
from s3transfer.bandwidth import RequestExceededException
from s3transfer.bandwidth import RequestToken
from s3transfer.bandwidth import TimeUtils
Expand Down
8 changes: 3 additions & 5 deletions tests/unit/test_crt.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,14 @@
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
import unittest
import mock

from botocore.session import Session
from botocore.credentials import CredentialResolver, ReadOnlyCredentials
from s3transfer.exceptions import TransferNotDoneError
from s3transfer.utils import CallArgs

from tests import FileCreator
from tests import requires_crt, HAS_CRT
from tests import (
FileCreator, requires_crt, HAS_CRT, mock, unittest
)

if HAS_CRT:
import awscrt.s3
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import shutil
import tempfile
import socket
import mock

from tests import BaseTaskTest
from tests import BaseSubmissionTaskTest
from tests import StreamWithError
from tests import FileCreator
from tests import mock
from tests import unittest
from tests import RecordingExecutor
from tests import NonSeekableWriter
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import time
import traceback

import mock
from concurrent.futures import ThreadPoolExecutor

from tests import unittest
from tests import mock
from tests import RecordingExecutor
from tests import TransferCoordinatorWithInterrupt
from s3transfer.exceptions import CancelledError
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_processpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import time
import threading

import mock
from six.moves import queue
from botocore.exceptions import ClientError
from botocore.exceptions import ReadTimeoutError
from botocore.client import BaseClient
from botocore.config import Config

from tests import unittest
from tests import mock
from tests import skip_if_windows
from tests import FileCreator
from tests import StreamWithError
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_s3transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
import tempfile
import shutil
import socket
from tests import unittest
from tests import mock, unittest
from contextlib import closing

import mock
from botocore.vendored import six
from concurrent import futures

Expand Down
5 changes: 1 addition & 4 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@
import time
import io

import mock

from tests import unittest
from tests import RecordingSubscriber
from tests import NonSeekableWriter
from tests import mock, unittest, RecordingSubscriber, NonSeekableWriter
from s3transfer.compat import six
from s3transfer.futures import TransferFuture
from s3transfer.futures import TransferMeta
Expand Down

0 comments on commit 7019ae7

Please sign in to comment.