diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7d98291..108063d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:58f73ba196b5414782605236dd0712a73541b44ff2ff4d3a36ec41092dd6fa5b + digest: sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg index 4365360..6701ad1 100644 --- a/.kokoro/docs/common.cfg +++ b/.kokoro/docs/common.cfg @@ -30,6 +30,7 @@ env_vars: { env_vars: { key: "V2_STAGING_BUCKET" + # Push google cloud library docs to the Cloud RAD bucket `docs-staging-v2` value: "docs-staging-v2" } diff --git a/CHANGELOG.md b/CHANGELOG.md index dbf4419..4e456b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +### [1.3.1](https://www.github.com/googleapis/python-bigquery-connection/compare/v1.3.0...v1.3.1) (2021-11-02) + + +### Bug Fixes + +* **deps:** drop packaging dependency ([826da22](https://www.github.com/googleapis/python-bigquery-connection/commit/826da22f591ab1c16eadf3a53cc8476e04577f40)) +* **deps:** require google-api-core >= 1.28.0 ([826da22](https://www.github.com/googleapis/python-bigquery-connection/commit/826da22f591ab1c16eadf3a53cc8476e04577f40)) + + +### Documentation + +* list oneofs in docstring ([826da22](https://www.github.com/googleapis/python-bigquery-connection/commit/826da22f591ab1c16eadf3a53cc8476e04577f40)) + ## [1.3.0](https://www.github.com/googleapis/python-bigquery-connection/compare/v1.2.3...v1.3.0) (2021-10-08) diff --git a/docs/index.rst b/docs/index.rst index 944bf8d..3e3f392 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,8 @@ .. include:: README.rst + .. include:: multiprocessing.rst + API Reference ------------- .. toctree:: @@ -9,12 +11,13 @@ API Reference bigquery_connection_v1/services bigquery_connection_v1/types + Changelog --------- For a list of all ``google-cloud-bigquery-connection`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py b/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py index b5b09f5..467ed46 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/async_client.py @@ -19,13 +19,15 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -import google.api_core.client_options as ClientOptions # type: ignore +from google.api_core.client_options import ClientOptions # type: ignore from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.bigquery_connection_v1.services.connection_service import pagers from google.cloud.bigquery_connection_v1.types import connection from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection @@ -167,19 +169,19 @@ def __init__( async def create_connection( self, - request: gcbc_connection.CreateConnectionRequest = None, + request: Union[gcbc_connection.CreateConnectionRequest, dict] = None, *, parent: str = None, connection: gcbc_connection.Connection = None, connection_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcbc_connection.Connection: r"""Creates a new connection. Args: - request (:class:`google.cloud.bigquery_connection_v1.types.CreateConnectionRequest`): + request (Union[google.cloud.bigquery_connection_v1.types.CreateConnectionRequest, dict]): The request object. The request for [ConnectionService.CreateConnection][google.cloud.bigquery.connection.v1.ConnectionService.CreateConnection]. parent (:class:`str`): @@ -257,17 +259,17 @@ async def create_connection( async def get_connection( self, - request: connection.GetConnectionRequest = None, + request: Union[connection.GetConnectionRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> connection.Connection: r"""Returns specified connection. Args: - request (:class:`google.cloud.bigquery_connection_v1.types.GetConnectionRequest`): + request (Union[google.cloud.bigquery_connection_v1.types.GetConnectionRequest, dict]): The request object. The request for [ConnectionService.GetConnection][google.cloud.bigquery.connection.v1.ConnectionService.GetConnection]. name (:class:`str`): @@ -339,17 +341,17 @@ async def get_connection( async def list_connections( self, - request: connection.ListConnectionsRequest = None, + request: Union[connection.ListConnectionsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListConnectionsAsyncPager: r"""Returns a list of connections in the given project. Args: - request (:class:`google.cloud.bigquery_connection_v1.types.ListConnectionsRequest`): + request (Union[google.cloud.bigquery_connection_v1.types.ListConnectionsRequest, dict]): The request object. The request for [ConnectionService.ListConnections][google.cloud.bigquery.connection.v1.ConnectionService.ListConnections]. parent (:class:`str`): @@ -429,12 +431,12 @@ async def list_connections( async def update_connection( self, - request: gcbc_connection.UpdateConnectionRequest = None, + request: Union[gcbc_connection.UpdateConnectionRequest, dict] = None, *, name: str = None, connection: gcbc_connection.Connection = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcbc_connection.Connection: @@ -443,7 +445,7 @@ async def update_connection( are in the update field mask. Args: - request (:class:`google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest`): + request (Union[google.cloud.bigquery_connection_v1.types.UpdateConnectionRequest, dict]): The request object. The request for [ConnectionService.UpdateConnection][google.cloud.bigquery.connection.v1.ConnectionService.UpdateConnection]. name (:class:`str`): @@ -523,17 +525,17 @@ async def update_connection( async def delete_connection( self, - request: connection.DeleteConnectionRequest = None, + request: Union[connection.DeleteConnectionRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes connection and associated credential. Args: - request (:class:`google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest`): + request (Union[google.cloud.bigquery_connection_v1.types.DeleteConnectionRequest, dict]): The request object. The request for [ConnectionService.DeleteConnectionRequest][]. name (:class:`str`): @@ -597,10 +599,10 @@ async def delete_connection( async def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, *, resource: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: @@ -609,7 +611,7 @@ async def get_iam_policy( not have a policy set. Args: - request (:class:`google.iam.v1.iam_policy_pb2.GetIamPolicyRequest`): + request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]): The request object. Request message for `GetIamPolicy` method. resource (:class:`str`): @@ -725,10 +727,10 @@ async def get_iam_policy( async def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, *, resource: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: @@ -739,7 +741,7 @@ async def set_iam_policy( ``PERMISSION_DENIED`` errors. Args: - request (:class:`google.iam.v1.iam_policy_pb2.SetIamPolicyRequest`): + request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]): The request object. Request message for `SetIamPolicy` method. resource (:class:`str`): @@ -855,11 +857,11 @@ async def set_iam_policy( async def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, *, resource: str = None, permissions: Sequence[str] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: @@ -873,7 +875,7 @@ async def test_iam_permissions( warning. Args: - request (:class:`google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest`): + request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]): The request object. Request message for `TestIamPermissions` method. resource (:class:`str`): diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/client.py b/google/cloud/bigquery_connection_v1/services/connection_service/client.py index fa3473c..9337bf5 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/client.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/client.py @@ -30,6 +30,8 @@ from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +OptionalRetry = Union[retries.Retry, object] + from google.cloud.bigquery_connection_v1.services.connection_service import pagers from google.cloud.bigquery_connection_v1.types import connection from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection @@ -360,7 +362,7 @@ def create_connection( parent: str = None, connection: gcbc_connection.Connection = None, connection_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcbc_connection.Connection: @@ -448,7 +450,7 @@ def get_connection( request: Union[connection.GetConnectionRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> connection.Connection: @@ -520,7 +522,7 @@ def list_connections( request: Union[connection.ListConnectionsRequest, dict] = None, *, parent: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListConnectionsPager: @@ -602,7 +604,7 @@ def update_connection( name: str = None, connection: gcbc_connection.Connection = None, update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcbc_connection.Connection: @@ -694,7 +696,7 @@ def delete_connection( request: Union[connection.DeleteConnectionRequest, dict] = None, *, name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: @@ -758,7 +760,7 @@ def get_iam_policy( request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, *, resource: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: @@ -885,7 +887,7 @@ def set_iam_policy( request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, *, resource: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: @@ -1015,7 +1017,7 @@ def test_iam_permissions( *, resource: str = None, permissions: Sequence[str] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, + retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py index 2bd9d67..30e64ec 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/base.py @@ -15,7 +15,6 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import packaging.version import pkg_resources import google.auth # type: ignore @@ -41,15 +40,6 @@ except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -try: - # google.auth.__version__ was added in 1.26.0 - _GOOGLE_AUTH_VERSION = google.auth.__version__ -except AttributeError: - try: # try pkg_resources if it is available - _GOOGLE_AUTH_VERSION = pkg_resources.get_distribution("google-auth").version - except pkg_resources.DistributionNotFound: # pragma: NO COVER - _GOOGLE_AUTH_VERSION = None - class ConnectionServiceTransport(abc.ABC): """Abstract transport class for ConnectionService.""" @@ -102,7 +92,7 @@ def __init__( host += ":443" self._host = host - scopes_kwargs = self._get_scopes_kwargs(self._host, scopes) + scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. self._scopes = scopes @@ -135,29 +125,6 @@ def __init__( # Save the credentials. self._credentials = credentials - # TODO(busunkim): This method is in the base transport - # to avoid duplicating code across the transport classes. These functions - # should be deleted once the minimum required versions of google-auth is increased. - - # TODO: Remove this function once google-auth >= 1.25.0 is required - @classmethod - def _get_scopes_kwargs( - cls, host: str, scopes: Optional[Sequence[str]] - ) -> Dict[str, Optional[Sequence[str]]]: - """Returns scopes kwargs to pass to google-auth methods depending on the google-auth version""" - - scopes_kwargs = {} - - if _GOOGLE_AUTH_VERSION and ( - packaging.version.parse(_GOOGLE_AUTH_VERSION) - >= packaging.version.parse("1.25.0") - ): - scopes_kwargs = {"scopes": scopes, "default_scopes": cls.AUTH_SCOPES} - else: - scopes_kwargs = {"scopes": scopes or cls.AUTH_SCOPES} - - return scopes_kwargs - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { diff --git a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py index d0e8f8d..23da5e4 100644 --- a/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_connection_v1/services/connection_service/transports/grpc_asyncio.py @@ -20,7 +20,6 @@ from google.api_core import grpc_helpers_async # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -import packaging.version import grpc # type: ignore from grpc.experimental import aio # type: ignore diff --git a/google/cloud/bigquery_connection_v1/types/connection.py b/google/cloud/bigquery_connection_v1/types/connection.py index 92162ee..a03b00b 100644 --- a/google/cloud/bigquery_connection_v1/types/connection.py +++ b/google/cloud/bigquery_connection_v1/types/connection.py @@ -148,6 +148,13 @@ class Connection(proto.Message): r"""Configuration parameters to establish connection with an external data source, except the credential attributes. + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): The resource name of the connection in the form of: @@ -159,10 +166,13 @@ class Connection(proto.Message): User provided description. cloud_sql (google.cloud.bigquery_connection_v1.types.CloudSqlProperties): Cloud SQL properties. + This field is a member of `oneof`_ ``properties``. aws (google.cloud.bigquery_connection_v1.types.AwsProperties): Amazon Web Services (AWS) properties. + This field is a member of `oneof`_ ``properties``. cloud_spanner (google.cloud.bigquery_connection_v1.types.CloudSpannerProperties): Cloud Spanner properties. + This field is a member of `oneof`_ ``properties``. creation_time (int): Output only. The creation timestamp of the connection. @@ -251,14 +261,23 @@ class CloudSpannerProperties(proto.Message): class AwsProperties(proto.Message): r"""Connection properties specific to Amazon Web Services (AWS). + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: cross_account_role (google.cloud.bigquery_connection_v1.types.AwsCrossAccountRole): Authentication using Google owned AWS IAM user's access key to assume into customer's AWS IAM Role. + This field is a member of `oneof`_ ``authentication_method``. access_role (google.cloud.bigquery_connection_v1.types.AwsAccessRole): Authentication using Google owned service account to assume into customer's AWS IAM Role. + This field is a member of `oneof`_ ``authentication_method``. """ cross_account_role = proto.Field( diff --git a/noxfile.py b/noxfile.py index f885c68..2a2001c 100644 --- a/noxfile.py +++ b/noxfile.py @@ -101,7 +101,7 @@ def default(session): "py.test", "--quiet", f"--junitxml=unit_{session.python}_sponge_log.xml", - "--cov=google/cloud", + "--cov=google", "--cov=tests/unit", "--cov-append", "--cov-config=.coveragerc", @@ -175,7 +175,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=99") + session.run("coverage", "report", "--show-missing", "--fail-under=100") session.run("coverage", "erase") diff --git a/owlbot.py b/owlbot.py deleted file mode 100644 index d13854b..0000000 --- a/owlbot.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is 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. - -"""This script is used to synthesize generated parts of this library.""" -import os - -import synthtool as s -import synthtool.gcp as gcp -from synthtool.languages import python - -common = gcp.CommonTemplates() - -default_version = "v1" - -for library in s.get_staging_dirs(default_version): - s.move(library, excludes=["setup.py", "README.rst", "docs/index.rst", "*.tar.gz"]) - -s.remove_staging_dirs() - -# ---------------------------------------------------------------------------- -# Add templated files -# ---------------------------------------------------------------------------- -templated_files = common.py_library(cov_level=99, microgenerator=True,) -python.py_samples(skip_readmes=True) -s.move( - templated_files, excludes=[".coveragerc"] -) # the microgenerator has a good coveragerc file - -# Remove the replacements below once https://github.com/googleapis/synthtool/pull/1188 is merged - -# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files -s.replace( - ".kokoro/*.sh", "repo-automation-bots/tree/master", "repo-automation-bots/tree/main" -) - -# Customize CONTRIBUTING.rst to replace master with main -s.replace( - "CONTRIBUTING.rst", - "fetch and merge changes from upstream into master", - "fetch and merge changes from upstream into main", -) - -s.replace( - "CONTRIBUTING.rst", "git merge upstream/master", "git merge upstream/main", -) - -s.replace( - "CONTRIBUTING.rst", - """export GOOGLE_CLOUD_TESTING_BRANCH=\"master\"""", - """export GOOGLE_CLOUD_TESTING_BRANCH=\"main\"""", -) - -s.replace( - "CONTRIBUTING.rst", "remote \(``master``\)", "remote (``main``)", -) - -s.replace( - "CONTRIBUTING.rst", "blob/master/CONTRIBUTING.rst", "blob/main/CONTRIBUTING.rst", -) - -s.replace( - "CONTRIBUTING.rst", "blob/master/noxfile.py", "blob/main/noxfile.py", -) - -s.replace( - "docs/conf.py", "master_doc", "root_doc", -) - -s.replace( - "docs/conf.py", "# The master toctree document.", "# The root toctree document.", -) - -s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/setup.py b/setup.py index d41dadc..e891c10 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import os import setuptools # type: ignore -version = "1.3.0" +version = "1.3.1" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -47,9 +47,8 @@ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core >= 1.22.2, <3.0.0dev", + "google-api-core >= 1.28.0, <3.0.0dev", "proto-plus >= 1.4.0", - "packaging >= 14.3", "grpc-google-iam-v1 >= 0.12.3, < 0.13.0dev", ), python_requires=">=3.6", @@ -60,6 +59,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules", ], diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index fbed252..aaf4a35 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -5,7 +5,6 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.26.0 +google-api-core==1.28.0 proto-plus==1.4.0 grpc-google-iam-v1==0.12.3 -packaging==14.3 diff --git a/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py b/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py index 6edc88e..d5a0a83 100644 --- a/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py +++ b/tests/unit/gapic/bigquery_connection_v1/test_connection_service.py @@ -15,7 +15,6 @@ # import os import mock -import packaging.version import grpc from grpc.experimental import aio @@ -40,9 +39,6 @@ ) from google.cloud.bigquery_connection_v1.services.connection_service import pagers from google.cloud.bigquery_connection_v1.services.connection_service import transports -from google.cloud.bigquery_connection_v1.services.connection_service.transports.base import ( - _GOOGLE_AUTH_VERSION, -) from google.cloud.bigquery_connection_v1.types import connection from google.cloud.bigquery_connection_v1.types import connection as gcbc_connection from google.iam.v1 import iam_policy_pb2 # type: ignore @@ -54,20 +50,6 @@ import google.auth -# TODO(busunkim): Once google-auth >= 1.25.0 is required transitively -# through google-api-core: -# - Delete the auth "less than" test cases -# - Delete these pytest markers (Make the "greater than or equal to" tests the default). -requires_google_auth_lt_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) >= packaging.version.parse("1.25.0"), - reason="This test requires google-auth < 1.25.0", -) -requires_google_auth_gte_1_25_0 = pytest.mark.skipif( - packaging.version.parse(_GOOGLE_AUTH_VERSION) < packaging.version.parse("1.25.0"), - reason="This test requires google-auth >= 1.25.0", -) - - def client_cert_source_callback(): return b"cert bytes", b"key bytes" @@ -225,7 +207,7 @@ def test_connection_service_client_client_options( options = client_options.ClientOptions(api_endpoint="squid.clam.whelk") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -242,7 +224,7 @@ def test_connection_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -259,7 +241,7 @@ def test_connection_service_client_client_options( with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -288,7 +270,7 @@ def test_connection_service_client_client_options( options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -357,7 +339,7 @@ def test_connection_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) if use_client_cert_env == "false": expected_client_cert_source = None @@ -399,7 +381,7 @@ def test_connection_service_client_mtls_env_auto( expected_client_cert_source = client_cert_source_callback patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -421,7 +403,7 @@ def test_connection_service_client_mtls_env_auto( return_value=False, ): patched.return_value = None - client = client_class() + client = client_class(transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -452,7 +434,7 @@ def test_connection_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -483,7 +465,7 @@ def test_connection_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(client_options=options) + client = client_class(transport=transport_name, client_options=options) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -2613,7 +2595,6 @@ def test_connection_service_base_transport(): transport.close() -@requires_google_auth_gte_1_25_0 def test_connection_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file with mock.patch.object( @@ -2637,29 +2618,6 @@ def test_connection_service_base_transport_with_credentials_file(): ) -@requires_google_auth_lt_1_25_0 -def test_connection_service_base_transport_with_credentials_file_old_google_auth(): - # Instantiate the base transport with a credentials file - with mock.patch.object( - google.auth, "load_credentials_from_file", autospec=True - ) as load_creds, mock.patch( - "google.cloud.bigquery_connection_v1.services.connection_service.transports.ConnectionServiceTransport._prep_wrapped_messages" - ) as Transport: - Transport.return_value = None - load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) - transport = transports.ConnectionServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", - ) - load_creds.assert_called_once_with( - "credentials.json", - scopes=( - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/cloud-platform", - ), - quota_project_id="octopus", - ) - - def test_connection_service_base_transport_with_adc(): # Test the default credentials are used if credentials and credentials_file are None. with mock.patch.object(google.auth, "default", autospec=True) as adc, mock.patch( @@ -2671,7 +2629,6 @@ def test_connection_service_base_transport_with_adc(): adc.assert_called_once() -@requires_google_auth_gte_1_25_0 def test_connection_service_auth_adc(): # If no credentials are provided, we should use ADC credentials. with mock.patch.object(google.auth, "default", autospec=True) as adc: @@ -2687,21 +2644,6 @@ def test_connection_service_auth_adc(): ) -@requires_google_auth_lt_1_25_0 -def test_connection_service_auth_adc_old_google_auth(): - # If no credentials are provided, we should use ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - ConnectionServiceClient() - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/cloud-platform", - ), - quota_project_id=None, - ) - - @pytest.mark.parametrize( "transport_class", [ @@ -2709,7 +2651,6 @@ def test_connection_service_auth_adc_old_google_auth(): transports.ConnectionServiceGrpcAsyncIOTransport, ], ) -@requires_google_auth_gte_1_25_0 def test_connection_service_transport_auth_adc(transport_class): # If credentials and host are not provided, the transport class should use # ADC credentials. @@ -2726,29 +2667,6 @@ def test_connection_service_transport_auth_adc(transport_class): ) -@pytest.mark.parametrize( - "transport_class", - [ - transports.ConnectionServiceGrpcTransport, - transports.ConnectionServiceGrpcAsyncIOTransport, - ], -) -@requires_google_auth_lt_1_25_0 -def test_connection_service_transport_auth_adc_old_google_auth(transport_class): - # If credentials and host are not provided, the transport class should use - # ADC credentials. - with mock.patch.object(google.auth, "default", autospec=True) as adc: - adc.return_value = (ga_credentials.AnonymousCredentials(), None) - transport_class(quota_project_id="octopus") - adc.assert_called_once_with( - scopes=( - "https://www.googleapis.com/auth/bigquery", - "https://www.googleapis.com/auth/cloud-platform", - ), - quota_project_id="octopus", - ) - - @pytest.mark.parametrize( "transport_class,grpc_helpers", [