Skip to content

Commit a0f4cdb

Browse files
committed
fix: add missing protobuf imports in GAPIC unit tests
1 parent b5350e6 commit a0f4cdb

1 file changed

Lines changed: 77 additions & 0 deletions

File tree

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
description: Add missing protobuf and IAM imports in generated GAPIC unit tests
15+
replacements:
16+
- paths:
17+
- "packages/*/tests/unit/gapic/**/*.py"
18+
- "preview-packages/*/tests/unit/gapic/**/*.py"
19+
before: '(import google\.iam\.v1\.policy_pb2 as policy_pb2 # type: ignore\n)(?!import google\.iam\.v1\.options_pb2)'
20+
after: |
21+
\g<1>import google.iam.v1.options_pb2 as options_pb2 # type: ignore
22+
- paths:
23+
- packages/google-cloud-billing/tests/unit/gapic/billing_v1/test_cloud_billing.py
24+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
25+
after: |
26+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
27+
count: 1
28+
- paths:
29+
- packages/google-cloud-containeranalysis/tests/unit/gapic/containeranalysis_v1/test_container_analysis.py
30+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
31+
after: |
32+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
33+
count: 1
34+
- paths:
35+
- packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1/test_policy_tag_manager.py
36+
- packages/google-cloud-datacatalog/tests/unit/gapic/datacatalog_v1beta1/test_policy_tag_manager.py
37+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
38+
after: |
39+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
40+
count: 2
41+
- paths:
42+
- packages/google-cloud-iam/tests/unit/gapic/iam_admin_v1/test_iam.py
43+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
44+
after: |
45+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
46+
count: 1
47+
- paths:
48+
- packages/google-cloud-resource-manager/tests/unit/gapic/resourcemanager_v3/test_organizations.py
49+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
50+
after: |
51+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
52+
count: 1
53+
- paths:
54+
- packages/google-cloud-run/tests/unit/gapic/run_v2/test_jobs.py
55+
before: '(import google\.auth\n)(?!import google\.protobuf\.field_mask_pb2)'
56+
after: |
57+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
58+
count: 1
59+
- paths:
60+
- packages/google-cloud-functions/tests/unit/gapic/functions_v1/test_cloud_functions_service.py
61+
before: '(import google\.protobuf\.empty_pb2 as empty_pb2 # type: ignore\n)(?!import google\.protobuf\.field_mask_pb2)'
62+
after: |
63+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
64+
count: 1
65+
- paths:
66+
- packages/google-cloud-securitycenter/tests/unit/gapic/securitycenter_v1beta1/test_security_center.py
67+
before: '(import google\.protobuf\.empty_pb2 as empty_pb2 # type: ignore\n)(?!import google\.protobuf\.field_mask_pb2)'
68+
after: |
69+
\g<1>import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
70+
count: 1
71+
- paths:
72+
- packages/google-cloud-managedkafka/tests/unit/gapic/managedkafka_v1/test_managed_kafka_connect.py
73+
before: '(import google\.protobuf\.empty_pb2 as empty_pb2 # type: ignore\n)(?!import google\.protobuf\.duration_pb2)'
74+
after: |
75+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
76+
\g<1>
77+
count: 1

0 commit comments

Comments
 (0)