googleapis / googleapis/google-cloud-python

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

Abierto
#16,295 2 comentarios 0 reacciones 1 asignado Reclamado por @ohmayr Ver en GitHub
priority: p2 type: process
Lenguaje dominante
Python
Estrellas
5.4k
Forks
1.8k
Merge medio
3 d 4 h
PR fusionados (30 d)
122

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.