googleapis / googleapis/google-cloud-python

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

Đang mở
#16,295 2 bình luận 0 reaction 1 người được giao Được @ohmayr nhận Xem trên GitHub
priority: p2 type: process
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

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.
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.