Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the dependency on the separate package mock. #770

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions noxfile.py
Expand Up @@ -78,7 +78,7 @@ def default(session):
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
# Install all test dependencies, then install this package in-place.
session.install("mock", "pytest", "pytest-cov", "-c", constraints_path)
session.install("pytest", "pytest-cov", "-c", constraints_path)
session.install("-e", ".", "-c", constraints_path)

# Run py.test against the unit tests.
Expand Down Expand Up @@ -136,7 +136,7 @@ def system(session):
# 2021-05-06: defer installing 'google-cloud-*' to after this package,
# in order to work around Python 2.7 googolapis-common-protos
# issue.
session.install("mock", "pytest", "-c", constraints_path)
session.install("pytest", "-c", constraints_path)
session.install("-e", ".", "-c", constraints_path)
session.install(
"google-cloud-testutils",
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/notification_polling_test.py
Expand Up @@ -14,7 +14,7 @@


from google.cloud.pubsub_v1.subscriber.message import Message
import mock
from unittest import mock

from notification_polling import summarize

Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/quickstart_test.py
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import mock
from unittest import mock

import quickstart

Expand Down
1 change: 0 additions & 1 deletion samples/snippets/requirements-test.txt
@@ -1,3 +1,2 @@
pytest==7.1.1
mock==4.0.3
backoff==1.11.1
2 changes: 1 addition & 1 deletion tests/system/test_blob.py
Expand Up @@ -18,9 +18,9 @@
import os
import tempfile
import warnings
from unittest import mock

import pytest
import mock

from google import resumable_media
from google.api_core import exceptions
Expand Down
5 changes: 1 addition & 4 deletions tests/unit/test__helpers.py
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

import unittest

import mock
from unittest import mock

from google.cloud.storage.retry import DEFAULT_RETRY
from google.cloud.storage.retry import DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED
Expand Down Expand Up @@ -556,8 +555,6 @@ def test_it(self):
self.assertEqual(SIGNED_CONTENT, b"kBiQqOnIz21aGlQrIp/r/w==")

def test_it_with_stubs(self):
import mock

class _Buffer(object):
def __init__(self, return_vals):
self.return_vals = return_vals
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test__http.py
Expand Up @@ -14,8 +14,7 @@

import unittest
from unittest.mock import patch

import mock
from unittest import mock

from google.cloud.storage import _helpers
from tests.unit.test__helpers import GCCL_INVOCATION_TEST_CONST
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test__signing.py
Expand Up @@ -22,8 +22,8 @@
import time
import unittest
import urllib.parse
from unittest import mock

import mock
import pytest

from . import _read_local_json
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_acl.py
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

import unittest

import mock
from unittest import mock

from google.cloud.storage.retry import (
DEFAULT_RETRY,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_batch.py
Expand Up @@ -16,8 +16,8 @@
from http.client import SERVICE_UNAVAILABLE
from http.client import NO_CONTENT
import unittest
from unittest import mock

import mock
import requests


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_blob.py
Expand Up @@ -22,9 +22,9 @@
import unittest
import http.client
from unittest.mock import patch
from unittest import mock
from urllib.parse import urlencode

import mock
import pytest

from google.cloud.storage import _helpers
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_bucket.py
Expand Up @@ -14,8 +14,8 @@

import datetime
import unittest
from unittest import mock

import mock
import pytest

from google.cloud.storage.retry import DEFAULT_RETRY
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_client.py
Expand Up @@ -16,13 +16,13 @@
import http.client
import io
import json
from unittest.mock import patch
import mock
import pytest
import re
import requests
import unittest
import urllib
from unittest.mock import patch
from unittest import mock

from google.api_core import exceptions
from google.auth.credentials import AnonymousCredentials
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_fileio.py
Expand Up @@ -17,8 +17,8 @@
import unittest
import io
import string
from unittest import mock

import mock

from google.api_core.exceptions import RequestRangeNotSatisfiable
from google.cloud.storage.retry import DEFAULT_RETRY
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_hmac_key.py
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

import unittest

import mock
from unittest import mock

from google.cloud.storage.retry import DEFAULT_RETRY
from google.cloud.storage.retry import DEFAULT_RETRY_IF_ETAG_IN_JSON
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_notification.py
Expand Up @@ -13,8 +13,7 @@
# limitations under the License.

import unittest

import mock
from unittest import mock

from google.cloud.storage.retry import DEFAULT_RETRY

Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_retry.py
Expand Up @@ -13,11 +13,10 @@
# limitations under the License.

import unittest
from unittest import mock

from google.cloud.storage import _helpers

import mock


class Test_should_retry(unittest.TestCase):
def _call_fut(self, exc):
Expand Down