Skip to content

Commit

Permalink
fix: Use unittest.mock if available
Browse files Browse the repository at this point in the history
The `mock` module is deprecated in recent Python versions.

Signed-off-by: Major Hayden <[email protected]>
  • Loading branch information
major committed May 19, 2022
1 parent c60556b commit 3fefb9d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
5 changes: 4 additions & 1 deletion tests/system/requests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
import urllib.parse

import pytest # type: ignore
import mock
try:
from unittest import mock
except ImportError:
import mock

from google.resumable_media import common
from google import resumable_media
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/requests/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import http.client

import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest # type: ignore

import requests.exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/requests/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import http.client
import io

import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest # type: ignore

from google.resumable_media import common
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/requests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import io
import json

import mock
try:
from unittest import mock
except ImportError:
import mock

import google.resumable_media.requests.upload as upload_mod

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test__helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import hashlib
import http.client

import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest # type: ignore

from google.resumable_media import _helpers
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test__upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import io
import sys

import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest # type: ignore

from google.resumable_media import _helpers
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import mock
try:
from unittest import mock
except ImportError:
import mock
import pytest # type: ignore

from google.resumable_media import common
Expand Down

0 comments on commit 3fefb9d

Please sign in to comment.