Skip to content

Commit 7a22cc3

Browse files
committed
fix(coverage): add # pragma: NO COVER to compatibility fallback blocks in _compat.py template and goldens
1 parent 5b77291 commit 7a22cc3

9 files changed

Lines changed: 36 additions & 36 deletions

File tree

  • packages/gapic-generator

packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/_compat.py.j2

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ try:
1919
get_api_endpoint,
2020
get_universe_domain,
2121
)
22-
except ImportError:
22+
except ImportError: # pragma: NO COVER
2323
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
2424
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
2525
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -91,7 +91,7 @@ try:
9191
get_client_cert_source,
9292
read_environment_variables,
9393
)
94-
except ImportError:
94+
except ImportError: # pragma: NO COVER
9595
from google.auth.transport import mtls # type: ignore
9696

9797
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -144,7 +144,7 @@ except ImportError:
144144

145145
try:
146146
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
147-
except ImportError:
147+
except ImportError: # pragma: NO COVER
148148
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
149149
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
150150
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -194,7 +194,7 @@ try:
194194
flatten_query_params,
195195
transcode_request,
196196
)
197-
except ImportError:
197+
except ImportError: # pragma: NO COVER
198198
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
199199
from google.protobuf import json_format # type: ignore
200200
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/asset/google/cloud/asset_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/credentials/google/iam/credentials_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/logging/google/cloud/logging_v2/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/logging_internal/google/cloud/logging_v2/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/redis/google/cloud/redis_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/redis_selective/google/cloud/redis_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

packages/gapic-generator/tests/integration/goldens/storagebatchoperations/google/cloud/storagebatchoperations_v1/_compat.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
get_api_endpoint,
3333
get_universe_domain,
3434
)
35-
except ImportError:
35+
except ImportError: # pragma: NO COVER
3636
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Universe domain support was introduced in google-api-core 2.18.0.
3737
# Remove these fallback definitions when google-api-core >= 2.18.0 becomes the minimum required version in generated client setup dependencies.
3838
def get_default_mtls_endpoint(api_endpoint: Optional[str]) -> Optional[str]:
@@ -104,7 +104,7 @@ def get_universe_domain(
104104
get_client_cert_source,
105105
read_environment_variables,
106106
)
107-
except ImportError:
107+
except ImportError: # pragma: NO COVER
108108
from google.auth.transport import mtls # type: ignore
109109

110110
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
@@ -157,7 +157,7 @@ def read_environment_variables() -> Tuple[bool, str, Optional[str]]:
157157

158158
try:
159159
from google.api_core.gapic_v1.request import setup_request_id # type: ignore
160-
except ImportError:
160+
except ImportError: # pragma: NO COVER
161161
# TODO(https://github.com/googleapis/google-cloud-python/issues/17813): Request ID setup helper was introduced in google-api-core 2.26.0.
162162
# Remove this fallback definition when google-api-core >= 2.26.0 becomes the minimum required version in generated client setup dependencies.
163163
def setup_request_id(request, field_name: str, is_proto3_optional: bool):
@@ -207,7 +207,7 @@ def setup_request_id(request, field_name: str, is_proto3_optional: bool):
207207
flatten_query_params,
208208
transcode_request,
209209
)
210-
except ImportError:
210+
except ImportError: # pragma: NO COVER
211211
# TODO: Remove these fallbacks when google-api-core >= 2.18.0 is the minimum required version.
212212
from google.protobuf import json_format # type: ignore
213213
from google.api_core import path_template # type: ignore

0 commit comments

Comments
 (0)