Skip to content

Commit

Permalink
feat(spanner): [Many APIs] Add support for Cloud Spanner Scheduled Ba…
Browse files Browse the repository at this point in the history
…ckups (#12872)

BEGIN_COMMIT_OVERRIDE
feat(spanner): Add support for Cloud Spanner Scheduled Backups
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 649277844

Source-Link:
googleapis/googleapis@fd7efa2

Source-Link:
googleapis/googleapis-gen@50be251
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LW5vdGlmaWNhdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXByb2R1Y3RzLy5Pd2xCb3QueWFtbCIsImgiOiI1MGJlMjUxMzI5ZDhkYjViNTU1NjI2ZWJkNDg4NjcyMWY1NDdkM2NjIn0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXByb21vdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXF1b3RhLy5Pd2xCb3QueWFtbCIsImgiOiI1MGJlMjUxMzI5ZDhkYjViNTU1NjI2ZWJkNDg4NjcyMWY1NDdkM2NjIn0=
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLW1lcmNoYW50LXJlcG9ydHMvLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLXNob3BwaW5nLXR5cGUvLk93bEJvdC55YW1sIiwiaCI6IjUwYmUyNTEzMjlkOGRiNWI1NTU2MjZlYmQ0ODg2NzIxZjU0N2QzY2MifQ==
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ3JhZmVhcy8uT3dsQm90LnlhbWwiLCJoIjoiNTBiZTI1MTMyOWQ4ZGI1YjU1NTYyNmViZDQ4ODY3MjFmNTQ3ZDNjYyJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Jul 4, 2024
1 parent 04ec204 commit eb36e8a
Show file tree
Hide file tree
Showing 54 changed files with 341 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def __init__(

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
self._ignore_credentials: bool = False

# If no credentials are provided, then determine the appropriate
# defaults.
Expand All @@ -96,7 +98,7 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None:
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def __init__(

if isinstance(channel, grpc.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def __init__(

if isinstance(channel, aio.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
46 changes: 35 additions & 11 deletions packages/google-shopping-merchant-notifications/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints):
session.install("-e", ".", *constraints)


def default(session):
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

# TODO(https://github.com/googleapis/synthtool/issues/1976):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
# The 'cpp' implementation requires Protobuf<4.
if protobuf_implementation == "cpp":
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand All @@ -181,15 +195,12 @@ def default(session):
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)


def install_systemtest_dependencies(session, *constraints):
# Use pre-release gRPC for system tests.
# Exclude version 1.52.0rc1 which has a known issue.
Expand Down Expand Up @@ -358,9 +369,16 @@ def docfx(session):


@nox.session(python="3.12")
def prerelease_deps(session):
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def prerelease_deps(session, protobuf_implementation):
"""Run all tests with prerelease versions of dependencies installed."""

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
Expand Down Expand Up @@ -397,9 +415,9 @@ def prerelease_deps(session):
"protobuf",
# dependency of grpc
"six",
"grpc-google-iam-v1",
"googleapis-common-protos",
# Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163
"grpcio!=1.52.0rc1",
"grpcio",
"grpcio-status",
"google-api-core",
"google-auth",
Expand All @@ -425,4 +443,10 @@ def prerelease_deps(session):
session.run("python", "-c", "import grpc; print(grpc.__version__)")
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")
session.run(
"py.test",
"tests/unit",
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)
2 changes: 1 addition & 1 deletion packages/google-shopping-merchant-notifications/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# See https://github.com/googleapis/google-cloud-python/issues/12364
"google-auth >= 2.14.1, <3.0.0dev,!=2.24.0,!=2.25.0",
"proto-plus >= 1.22.3, <2.0.0dev",
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"protobuf>=3.20.2,<6.0.0dev,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"google-shopping-type >= 0.1.0, <1.0.0dev",
]
url = "https://github.com/googleapis/google-cloud-python/tree/main/packages/google-shopping-merchant-notifications"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
google-api-core==1.34.1
google-auth==2.14.1
proto-plus==1.22.3
protobuf==3.19.5
protobuf==3.20.2
google-shopping-type==0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -1376,12 +1376,7 @@ async def test_get_notification_subscription_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
class AwaitableMock(mock.AsyncMock):
def __await__(self):
self.await_count += 1
return iter([])

mock_object = AwaitableMock()
mock_object = mock.AsyncMock()
client._client._transport._wrapped_methods[
client._client._transport.get_notification_subscription
] = mock_object
Expand Down Expand Up @@ -1786,12 +1781,7 @@ async def test_create_notification_subscription_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
class AwaitableMock(mock.AsyncMock):
def __await__(self):
self.await_count += 1
return iter([])

mock_object = AwaitableMock()
mock_object = mock.AsyncMock()
client._client._transport._wrapped_methods[
client._client._transport.create_notification_subscription
] = mock_object
Expand Down Expand Up @@ -2210,12 +2200,7 @@ async def test_update_notification_subscription_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
class AwaitableMock(mock.AsyncMock):
def __await__(self):
self.await_count += 1
return iter([])

mock_object = AwaitableMock()
mock_object = mock.AsyncMock()
client._client._transport._wrapped_methods[
client._client._transport.update_notification_subscription
] = mock_object
Expand Down Expand Up @@ -2621,12 +2606,7 @@ async def test_delete_notification_subscription_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
class AwaitableMock(mock.AsyncMock):
def __await__(self):
self.await_count += 1
return iter([])

mock_object = AwaitableMock()
mock_object = mock.AsyncMock()
client._client._transport._wrapped_methods[
client._client._transport.delete_notification_subscription
] = mock_object
Expand Down Expand Up @@ -3007,12 +2987,7 @@ async def test_list_notification_subscriptions_async_use_cached_wrapped_rpc(
)

# Replace cached wrapped function with mock
class AwaitableMock(mock.AsyncMock):
def __await__(self):
self.await_count += 1
return iter([])

mock_object = AwaitableMock()
mock_object = mock.AsyncMock()
client._client._transport._wrapped_methods[
client._client._transport.list_notification_subscriptions
] = mock_object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def __init__(

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
self._ignore_credentials: bool = False

# If no credentials are provided, then determine the appropriate
# defaults.
Expand All @@ -94,7 +96,7 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None:
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def __init__(

if isinstance(channel, grpc.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def __init__(

if isinstance(channel, aio.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def __init__(

# Save the scopes.
self._scopes = scopes
if not hasattr(self, "_ignore_credentials"):
self._ignore_credentials: bool = False

# If no credentials are provided, then determine the appropriate
# defaults.
Expand All @@ -93,7 +95,7 @@ def __init__(
credentials, _ = google.auth.load_credentials_from_file(
credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
)
elif credentials is None:
elif credentials is None and not self._ignore_credentials:
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def __init__(

if isinstance(channel, grpc.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def __init__(

if isinstance(channel, aio.Channel):
# Ignore credentials if a channel was passed.
credentials = False
credentials = None
self._ignore_credentials = True
# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
Expand Down
46 changes: 35 additions & 11 deletions packages/google-shopping-merchant-products/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,28 @@ def install_unittest_dependencies(session, *constraints):
session.install("-e", ".", *constraints)


def default(session):
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def unit(session, protobuf_implementation):
# Install all test dependencies, then install this package in-place.

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

constraints_path = str(
CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
)
install_unittest_dependencies(session, "-c", constraints_path)

# TODO(https://github.com/googleapis/synthtool/issues/1976):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
# The 'cpp' implementation requires Protobuf<4.
if protobuf_implementation == "cpp":
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
"py.test",
Expand All @@ -181,15 +195,12 @@ def default(session):
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)


@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
def unit(session):
"""Run the unit test suite."""
default(session)


def install_systemtest_dependencies(session, *constraints):
# Use pre-release gRPC for system tests.
# Exclude version 1.52.0rc1 which has a known issue.
Expand Down Expand Up @@ -358,9 +369,16 @@ def docfx(session):


@nox.session(python="3.12")
def prerelease_deps(session):
@nox.parametrize(
"protobuf_implementation",
["python", "upb", "cpp"],
)
def prerelease_deps(session, protobuf_implementation):
"""Run all tests with prerelease versions of dependencies installed."""

if protobuf_implementation == "cpp" and session.python in ("3.11", "3.12"):
session.skip("cpp implementation is not supported in python 3.11+")

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
Expand Down Expand Up @@ -397,9 +415,9 @@ def prerelease_deps(session):
"protobuf",
# dependency of grpc
"six",
"grpc-google-iam-v1",
"googleapis-common-protos",
# Exclude version 1.52.0rc1 which has a known issue. See https://github.com/grpc/grpc/issues/32163
"grpcio!=1.52.0rc1",
"grpcio",
"grpcio-status",
"google-api-core",
"google-auth",
Expand All @@ -425,4 +443,10 @@ def prerelease_deps(session):
session.run("python", "-c", "import grpc; print(grpc.__version__)")
session.run("python", "-c", "import google.auth; print(google.auth.__version__)")

session.run("py.test", "tests/unit")
session.run(
"py.test",
"tests/unit",
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
)
Loading

0 comments on commit eb36e8a

Please sign in to comment.