Skip to content

Use unittest.mock if it is available #208

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/asyncio/future/test_async_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import asyncio

import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/gapic/test_method_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import datetime

from grpc.experimental import aio
import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import (exceptions, gapic_v1, grpc_helpers_async,
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/operations_v1/test_operations_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.

from grpc.experimental import aio
import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import (grpc_helpers_async, operations_v1,
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/test_grpc_helpers_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import grpc
from grpc.experimental import aio
import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/test_operation_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.


import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/test_page_iterator_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import inspect

import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import page_iterator_async
Expand Down
5 changes: 4 additions & 1 deletion tests/asyncio/test_retry_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import datetime
import re

import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/future/test__helpers.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:
import mock

from google.api_core.future import _helpers

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/future/test_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import threading
import time

import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions, retry
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/gapic/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

import datetime

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

from google.api_core import exceptions
from google.api_core import retry
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_bidi.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
import threading

import grpc
import mock
try:
from unittest import mock
except:
import mock
import pytest
from six.moves import queue

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import json

import grpc
import mock
try:
from unittest import mock
except:
import mock
import requests
from six.moves import http_client

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_grpc_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.

import grpc
import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import exceptions
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
# limitations under the License.


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

from google.api_core import exceptions
from google.api_core import operation
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_page_iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import math
import types

import mock
try:
from unittest import mock
except:
import mock
import pytest
import six

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_path_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

from __future__ import unicode_literals

import mock
try:
from unittest import mock
except:
import mock
import pytest

from google.api_core import path_template
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import itertools
import re

import mock
try:
from unittest import mock
except:
import mock
import pytest
import requests.exceptions

Expand Down
5 changes: 4 additions & 1 deletion tests/unit/test_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
import datetime
import itertools

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

from google.api_core import timeout

Expand Down