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

Move modules in google.api.core.helpers up one level, delete google.a… #4196

Merged
merged 1 commit into from
Oct 16, 2017
Merged
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
4 changes: 2 additions & 2 deletions core/google/api/core/gapic_v1/method.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
import pkg_resources
import six

from google.api.core import general_helpers
from google.api.core import grpc_helpers
from google.api.core import page_iterator
from google.api.core import timeout
from google.api.core.helpers import general_helpers
from google.api.core.helpers import grpc_helpers

_PY_VERSION = platform.python_version()
_GRPC_VERSION = pkg_resources.get_distribution('grpcio').version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import six

from google.api.core import exceptions
from google.api.core.helpers import general_helpers
from google.api.core import general_helpers
import google.auth
import google.auth.transport.grpc
import google.auth.transport.requests
Expand Down
Empty file.
4 changes: 2 additions & 2 deletions core/google/api/core/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ def check_if_exists():

import six

from google.api.core import datetime_helpers
from google.api.core import exceptions
from google.api.core.helpers import datetime_helpers
from google.api.core.helpers import general_helpers
from google.api.core import general_helpers

_LOGGER = logging.getLogger(__name__)
_DEFAULT_INITIAL_DELAY = 1.0 # seconds
Expand Down
4 changes: 2 additions & 2 deletions core/google/api/core/timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def is_thing_ready(timeout=None):

import six

from google.api.core.helpers import datetime_helpers
from google.api.core.helpers import general_helpers
from google.api.core import datetime_helpers
from google.api.core import general_helpers

_DEFAULT_INITIAL_TIMEOUT = 5.0 # seconds
_DEFAULT_MAXIMUM_TIMEOUT = 30.0 # seconds
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/api_core/gapic/test_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_wrap_method_with_overriding_retry_and_timeout(unusued_sleep):

@mock.patch('time.sleep')
@mock.patch(
'google.api.core.helpers.datetime_helpers.utcnow',
'google.api.core.datetime_helpers.utcnow',
side_effect=_utcnow_monotonic(),
autospec=True)
def test_wrap_method_with_overriding_retry_deadline(utcnow, unused_sleep):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import datetime

from google.api.core.helpers import datetime_helpers
from google.api.core import datetime_helpers


def test_utcnow():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import functools

from google.api.core.helpers import general_helpers
from google.api.core import general_helpers


def test_wraps_normal_func():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import pytest

from google.api.core import exceptions
from google.api.core.helpers import grpc_helpers
from google.api.core import grpc_helpers


def test__patch_callable_name():
Expand Down Expand Up @@ -110,7 +110,7 @@ def test_wrap_stream_errors_iterator():
assert exc_info.value.response == grpc_error


@mock.patch('google.api.core.helpers.grpc_helpers._wrap_unary_errors')
@mock.patch('google.api.core.grpc_helpers._wrap_unary_errors')
def test_wrap_errors_non_streaming(wrap_unary_errors):
callable_ = mock.create_autospec(grpc.UnaryUnaryMultiCallable)

Expand All @@ -120,7 +120,7 @@ def test_wrap_errors_non_streaming(wrap_unary_errors):
wrap_unary_errors.assert_called_once_with(callable_)


@mock.patch('google.api.core.helpers.grpc_helpers._wrap_stream_errors')
@mock.patch('google.api.core.grpc_helpers._wrap_stream_errors')
def test_wrap_errors_streaming(wrap_stream_errors):
callable_ = mock.create_autospec(grpc.UnaryStreamMultiCallable)

Expand Down
8 changes: 4 additions & 4 deletions core/tests/unit/api_core/test_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_exponential_sleep_generator_base_2(uniform):

@mock.patch('time.sleep', autospec=True)
@mock.patch(
'google.api.core.helpers.datetime_helpers.utcnow',
'google.api.core.datetime_helpers.utcnow',
return_value=datetime.datetime.min,
autospec=True)
def test_retry_target_success(utcnow, sleep):
Expand All @@ -79,7 +79,7 @@ def target():

@mock.patch('time.sleep', autospec=True)
@mock.patch(
'google.api.core.helpers.datetime_helpers.utcnow',
'google.api.core.datetime_helpers.utcnow',
return_value=datetime.datetime.min,
autospec=True)
def test_retry_target_w_on_error(utcnow, sleep):
Expand Down Expand Up @@ -107,7 +107,7 @@ def target():

@mock.patch('time.sleep', autospec=True)
@mock.patch(
'google.api.core.helpers.datetime_helpers.utcnow',
'google.api.core.datetime_helpers.utcnow',
return_value=datetime.datetime.min,
autospec=True)
def test_retry_target_non_retryable_error(utcnow, sleep):
Expand All @@ -124,7 +124,7 @@ def test_retry_target_non_retryable_error(utcnow, sleep):

@mock.patch('time.sleep', autospec=True)
@mock.patch(
'google.api.core.helpers.datetime_helpers.utcnow', autospec=True)
'google.api.core.datetime_helpers.utcnow', autospec=True)
def test_retry_target_deadline_exceeded(utcnow, sleep):
predicate = retry.if_exception_type(ValueError)
exception = ValueError('meep')
Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/api_core/test_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test__exponential_timeout_generator_base_2():
assert result == [1, 2, 4, 8, 16, 32, 60, 60]


@mock.patch('google.api.core.helpers.datetime_helpers.utcnow', autospec=True)
@mock.patch('google.api.core.datetime_helpers.utcnow', autospec=True)
def test__exponential_timeout_generator_base_deadline(utcnow):
# Make each successive call to utcnow() advance one second.
utcnow.side_effect = [
Expand Down