googleapis / googleapis/google-cloud-python

Generated Code breaks unit tests of repositories containing handwritten layers wrapping Gapic

オープン
#16,295 コメント 2 件 リアクション 0 件 担当者 1 名 @ohmayr が担当を希望しています GitHub で見る
priority: p2 type: process
主要言語
Python
スター
5.4k
フォーク
1.8k
平均マージ
3日 4時間
マージ済み PR(30日)
122

説明

Ask: Generator code could have presubmits that ensure that dependent handwritten repository unit tests are not broken.

Example Link:https://github.com/googleapis/python-pubsub/actions/runs/9765604292/job/26956649154?pr=1154

Example test failures:

```
______________ test_sync_pull_warning_if_return_immediately_async ______________

creds =

@pytest.mark.asyncio
async def test_sync_pull_warning_if_return_immediately_async(creds):
from google.pubsub_v1.services.subscriber.async_client import SubscriberAsyncClient

client = SubscriberAsyncClient(credentials=creds)
subscription_path = "projects/foo/subscriptions/bar"

patcher = mock.patch(
"google.pubsub_v1.services.subscriber.async_client.gapic_v1.method_async.wrap_method",
new=mock.AsyncMock,
)

with patcher, pytest.warns(
DeprecationWarning,
match="The return_immediately flag is deprecated and should be set to False",
) as warned:
> await client.pull(subscription=subscription_path, return_immediately=True)

tests/unit/pubsub_v1/subscriber/test_subscriber_client.py:311:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
google/pubsub_v1/services/subscriber/async_client.py:1289: in pull
response = await rpc(
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/retry/retry_unary_async.py:230: in retry_wrapped_func
return await retry_target(
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/retry/retry_unary_async.py:160: in retry_target
_retry_error_helper(
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/retry/retry_base.py:212: in _retry_error_helper
raise final_exc from source_exc
.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/retry/retry_unary_async.py:155: in retry_target
return await target()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self =

def __await__(self) -> Iterator[P]:
try:
response = yield from self._call.__await__()
return response
except grpc.RpcError as rpc_error:
> raise exceptions.from_grpc_error(rpc_error) from rpc_error
E google.api_core.exceptions.PermissionDenied: 403 The request is missing a valid API key.

.nox/unit-3-9/lib/python3.9/site-packages/google/api_core/grpc_helpers_async.py:88: PermissionDenied
- generated xml file: /home/runner/work/python-pubsub/python-pubsub/unit_3.9_sponge_log.xml -
=========================== short test summary info ============================
FAILED tests/unit/pubsub_v1/subscriber/test_subscriber_client.py::test_sync_pull_warning_if_return_immediately_async - google.api_core.exceptions.PermissionDenied: 403 The request is missing a valid API key.
1 failed, 16[52](https://github.com/googleapis/python-pubsub/actions/runs/9765604292/job/26956649154?pr=1154#step:5:53) passed in 21.35s
nox > Command py.test --quiet --junitxml=unit_3.9_sponge_log.xml --cov=google/cloud --cov=tests/unit --cov-append --cov-config=.coveragerc --cov-report= --cov-fail-under=0 tests/unit failed with exit code 1
nox > Session unit-3.9 failed.
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。