diff --git a/google/cloud/scheduler_v1/services/cloud_scheduler/async_client.py b/google/cloud/scheduler_v1/services/cloud_scheduler/async_client.py index ac38f9b5..cff7ba3f 100644 --- a/google/cloud/scheduler_v1/services/cloud_scheduler/async_client.py +++ b/google/cloud/scheduler_v1/services/cloud_scheduler/async_client.py @@ -1252,7 +1252,7 @@ async def list_locations( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "CloudSchedulerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/scheduler_v1beta1/services/cloud_scheduler/async_client.py b/google/cloud/scheduler_v1beta1/services/cloud_scheduler/async_client.py index 49700fd5..1355e234 100644 --- a/google/cloud/scheduler_v1beta1/services/cloud_scheduler/async_client.py +++ b/google/cloud/scheduler_v1beta1/services/cloud_scheduler/async_client.py @@ -1273,7 +1273,7 @@ async def list_locations( # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "CloudSchedulerAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json index 70172b6b..4ab9d3e9 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-scheduler", - "version": "2.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json b/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json index 921376b4..240bb08c 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.scheduler.v1beta1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-scheduler", - "version": "2.11.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py b/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py index f5863228..e011e914 100644 --- a/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py +++ b/tests/unit/gapic/scheduler_v1/test_cloud_scheduler.py @@ -1123,9 +1123,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 @@ -1157,7 +1159,6 @@ def test_get_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.get_job(request) @@ -1402,7 +1403,6 @@ def test_create_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.create_job(request) @@ -1657,7 +1657,6 @@ def test_update_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.update_job(request) @@ -2132,7 +2131,6 @@ def test_pause_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.pause_job(request) @@ -2377,7 +2375,6 @@ def test_resume_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.resume_job(request) @@ -2622,7 +2619,6 @@ def test_run_job(request_type, transport: str = "grpc"): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.run_job(request) @@ -3200,7 +3196,6 @@ def test_get_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -3529,7 +3524,6 @@ def test_create_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -3930,7 +3924,6 @@ def test_update_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -4513,7 +4506,6 @@ def test_pause_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -4784,7 +4776,6 @@ def test_resume_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -5058,7 +5049,6 @@ def test_run_job_rest(request_type): schedule="schedule_value", time_zone="time_zone_value", state=job.Job.State.ENABLED, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj diff --git a/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py b/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py index 4cf7e404..43b23e15 100644 --- a/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py +++ b/tests/unit/gapic/scheduler_v1beta1/test_cloud_scheduler.py @@ -1123,9 +1123,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 @@ -1158,7 +1160,6 @@ def test_get_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.get_job(request) @@ -1407,7 +1408,6 @@ def test_create_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.create_job(request) @@ -1666,7 +1666,6 @@ def test_update_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.update_job(request) @@ -2145,7 +2144,6 @@ def test_pause_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.pause_job(request) @@ -2394,7 +2392,6 @@ def test_resume_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.resume_job(request) @@ -2643,7 +2640,6 @@ def test_run_job(request_type, transport: str = "grpc"): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) response = client.run_job(request) @@ -3229,7 +3225,6 @@ def test_get_job_rest(request_type): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -3561,7 +3556,6 @@ def test_create_job_rest(request_type): time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -3966,7 +3960,6 @@ def test_update_job_rest(request_type): time_zone="time_zone_value", state=gcs_job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -4555,7 +4548,6 @@ def test_pause_job_rest(request_type): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -4829,7 +4821,6 @@ def test_resume_job_rest(request_type): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj @@ -5105,7 +5096,6 @@ def test_run_job_rest(request_type): time_zone="time_zone_value", state=job.Job.State.ENABLED, legacy_app_engine_cron=True, - pubsub_target=target.PubsubTarget(topic_name="topic_name_value"), ) # Wrap the value into a proper Response obj