From 7c081a682a6d981ac3eed932f7c8e1e67f75af69 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:31:04 -0400 Subject: [PATCH] fix: Add async context manager return types (#539) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Add async context manager return types chore: Mock return_value should not populate oneof message fields chore: Support snippet generation for services that only support REST transport chore: Update gapic-generator-python to v1.11.0 PiperOrigin-RevId: 545430278 Source-Link: https://github.com/googleapis/googleapis/commit/601b5326107eeb74800b426d1f9933faa233258a Source-Link: https://github.com/googleapis/googleapis-gen/commit/b3f18d0f6560a855022fd058865e7620479d7af9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../async_client.py | 2 +- .../transports/rest.py | 6 ++-- .../services/batch_controller/async_client.py | 2 +- .../batch_controller/transports/rest.py | 6 ++-- .../cluster_controller/async_client.py | 2 +- .../cluster_controller/transports/rest.py | 6 ++-- .../services/job_controller/async_client.py | 2 +- .../job_controller/transports/rest.py | 6 ++-- .../node_group_controller/async_client.py | 2 +- .../node_group_controller/transports/rest.py | 6 ++-- .../workflow_template_service/async_client.py | 2 +- .../transports/rest.py | 6 ++-- ...pet_metadata_google.cloud.dataproc.v1.json | 2 +- .../test_autoscaling_policy_service.py | 36 +++---------------- .../dataproc_v1/test_batch_controller.py | 12 +++---- .../dataproc_v1/test_cluster_controller.py | 6 ++-- .../gapic/dataproc_v1/test_job_controller.py | 14 +++----- .../test_workflow_template_service.py | 6 ++-- 18 files changed, 45 insertions(+), 79 deletions(-) diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py index cd3f2b68..b9e236ec 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/async_client.py @@ -1368,7 +1368,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "AutoscalingPolicyServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py index 98a3fed8..1d8ee016 100644 --- a/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py +++ b/google/cloud/dataproc_v1/services/autoscaling_policy_service/transports/rest.py @@ -1088,7 +1088,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1188,7 +1188,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1290,7 +1290,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/dataproc_v1/services/batch_controller/async_client.py b/google/cloud/dataproc_v1/services/batch_controller/async_client.py index 730efbb3..a866f379 100644 --- a/google/cloud/dataproc_v1/services/batch_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/batch_controller/async_client.py @@ -1193,7 +1193,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "BatchControllerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/batch_controller/transports/rest.py b/google/cloud/dataproc_v1/services/batch_controller/transports/rest.py index d3c2ce15..85f53eca 100644 --- a/google/cloud/dataproc_v1/services/batch_controller/transports/rest.py +++ b/google/cloud/dataproc_v1/services/batch_controller/transports/rest.py @@ -945,7 +945,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1045,7 +1045,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1147,7 +1147,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/dataproc_v1/services/cluster_controller/async_client.py b/google/cloud/dataproc_v1/services/cluster_controller/async_client.py index 6bddb26c..c11d7f87 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/async_client.py @@ -1984,7 +1984,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ClusterControllerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py b/google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py index 09ee3992..ec728d83 100644 --- a/google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py +++ b/google/cloud/dataproc_v1/services/cluster_controller/transports/rest.py @@ -1523,7 +1523,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1623,7 +1623,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1725,7 +1725,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/dataproc_v1/services/job_controller/async_client.py b/google/cloud/dataproc_v1/services/job_controller/async_client.py index 591ef78a..8e8c5fc9 100644 --- a/google/cloud/dataproc_v1/services/job_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/job_controller/async_client.py @@ -1697,7 +1697,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "JobControllerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/job_controller/transports/rest.py b/google/cloud/dataproc_v1/services/job_controller/transports/rest.py index 02aa6034..17511880 100644 --- a/google/cloud/dataproc_v1/services/job_controller/transports/rest.py +++ b/google/cloud/dataproc_v1/services/job_controller/transports/rest.py @@ -1325,7 +1325,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1425,7 +1425,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1527,7 +1527,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/dataproc_v1/services/node_group_controller/async_client.py b/google/cloud/dataproc_v1/services/node_group_controller/async_client.py index 7548d83a..ce3b8d9c 100644 --- a/google/cloud/dataproc_v1/services/node_group_controller/async_client.py +++ b/google/cloud/dataproc_v1/services/node_group_controller/async_client.py @@ -1129,7 +1129,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "NodeGroupControllerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py b/google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py index 62a53d2b..4e2cbeda 100644 --- a/google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py +++ b/google/cloud/dataproc_v1/services/node_group_controller/transports/rest.py @@ -873,7 +873,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -973,7 +973,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1075,7 +1075,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py b/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py index 8ec6e397..996a3ccb 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/async_client.py @@ -1773,7 +1773,7 @@ async def test_iam_permissions( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "WorkflowTemplateServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py b/google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py index 86746ad2..814fab5a 100644 --- a/google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py +++ b/google/cloud/dataproc_v1/services/workflow_template_service/transports/rest.py @@ -1463,7 +1463,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1563,7 +1563,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -1665,7 +1665,7 @@ def __call__( request_kwargs = json_format.MessageToDict(request) transcoded_request = path_template.transcode(http_options, **request_kwargs) - body = json.loads(json.dumps(transcoded_request["body"])) + body = json.dumps(transcoded_request["body"]) uri = transcoded_request["uri"] method = transcoded_request["method"] diff --git a/samples/generated_samples/snippet_metadata_google.cloud.dataproc.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.dataproc.v1.json index f3c407bd..f1a48076 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.dataproc.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.dataproc.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-dataproc", - "version": "5.4.1" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py b/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py index d4660fe5..44385dc7 100644 --- a/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py +++ b/tests/unit/gapic/dataproc_v1/test_autoscaling_policy_service.py @@ -791,11 +791,6 @@ def test_create_autoscaling_policy(request_type, transport: str = "grpc"): call.return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) response = client.create_autoscaling_policy(request) @@ -1057,11 +1052,6 @@ def test_update_autoscaling_policy(request_type, transport: str = "grpc"): call.return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) response = client.update_autoscaling_policy(request) @@ -1313,11 +1303,6 @@ def test_get_autoscaling_policy(request_type, transport: str = "grpc"): call.return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) response = client.get_autoscaling_policy(request) @@ -1983,9 +1968,11 @@ async def test_list_autoscaling_policies_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_autoscaling_policies(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2266,11 +2253,6 @@ def test_create_autoscaling_policy_rest(request_type): return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) # Wrap the value into a proper Response obj @@ -2593,11 +2575,6 @@ def test_update_autoscaling_policy_rest(request_type): return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) # Wrap the value into a proper Response obj @@ -2894,11 +2871,6 @@ def test_get_autoscaling_policy_rest(request_type): return_value = autoscaling_policies.AutoscalingPolicy( id="id_value", name="name_value", - basic_algorithm=autoscaling_policies.BasicAutoscalingAlgorithm( - yarn_config=autoscaling_policies.BasicYarnAutoscalingConfig( - graceful_decommission_timeout=duration_pb2.Duration(seconds=751) - ) - ), ) # Wrap the value into a proper Response obj diff --git a/tests/unit/gapic/dataproc_v1/test_batch_controller.py b/tests/unit/gapic/dataproc_v1/test_batch_controller.py index 611f0880..947735f7 100644 --- a/tests/unit/gapic/dataproc_v1/test_batch_controller.py +++ b/tests/unit/gapic/dataproc_v1/test_batch_controller.py @@ -1015,9 +1015,6 @@ def test_get_batch(request_type, transport: str = "grpc"): state_message="state_message_value", creator="creator_value", operation="operation_value", - pyspark_batch=batches.PySparkBatch( - main_python_file_uri="main_python_file_uri_value" - ), ) response = client.get_batch(request) @@ -1651,9 +1648,11 @@ async def test_list_batches_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_batches(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2343,9 +2342,6 @@ def test_get_batch_rest(request_type): state_message="state_message_value", creator="creator_value", operation="operation_value", - pyspark_batch=batches.PySparkBatch( - main_python_file_uri="main_python_file_uri_value" - ), ) # Wrap the value into a proper Response obj diff --git a/tests/unit/gapic/dataproc_v1/test_cluster_controller.py b/tests/unit/gapic/dataproc_v1/test_cluster_controller.py index 2d22631e..67b5bf2d 100644 --- a/tests/unit/gapic/dataproc_v1/test_cluster_controller.py +++ b/tests/unit/gapic/dataproc_v1/test_cluster_controller.py @@ -2513,9 +2513,11 @@ async def test_list_clusters_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_clusters(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/dataproc_v1/test_job_controller.py b/tests/unit/gapic/dataproc_v1/test_job_controller.py index 50055cc3..6940a403 100644 --- a/tests/unit/gapic/dataproc_v1/test_job_controller.py +++ b/tests/unit/gapic/dataproc_v1/test_job_controller.py @@ -739,7 +739,6 @@ def test_submit_job(request_type, transport: str = "grpc"): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) response = client.submit_job(request) @@ -1264,7 +1263,6 @@ def test_get_job(request_type, transport: str = "grpc"): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) response = client.get_job(request) @@ -1943,9 +1941,11 @@ async def test_list_jobs_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_jobs(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -1976,7 +1976,6 @@ def test_update_job(request_type, transport: str = "grpc"): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) response = client.update_job(request) @@ -2141,7 +2140,6 @@ def test_cancel_job(request_type, transport: str = "grpc"): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) response = client.cancel_job(request) @@ -2650,7 +2648,6 @@ def test_submit_job_rest(request_type): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) # Wrap the value into a proper Response obj @@ -3216,7 +3213,6 @@ def test_get_job_rest(request_type): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) # Wrap the value into a proper Response obj @@ -3974,7 +3970,6 @@ def test_update_job_rest(request_type): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) # Wrap the value into a proper Response obj @@ -4320,7 +4315,6 @@ def test_cancel_job_rest(request_type): driver_control_files_uri="driver_control_files_uri_value", job_uuid="job_uuid_value", done=True, - hadoop_job=jobs.HadoopJob(main_jar_file_uri="main_jar_file_uri_value"), ) # Wrap the value into a proper Response obj diff --git a/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py b/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py index ba1adce0..b59ce8cc 100644 --- a/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py +++ b/tests/unit/gapic/dataproc_v1/test_workflow_template_service.py @@ -2484,9 +2484,11 @@ async def test_list_workflow_templates_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_workflow_templates(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token