googleapis / googleapis/google-cloud-python

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

Aperta
#16,295 2 commenti 0 reazioni 1 assegnatario Rivendicata da @ohmayr Vedi su GitHub
priority: p2 type: process
Lingua principale
Python
Stelle
5.4k
Fork
1.8k
Merge medio
3g 4h
PR unite (30g)
122

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.