Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit cd3fcae

Browse files
committed
Fix goldens
1 parent 5f4bb03 commit cd3fcae

7 files changed

Lines changed: 448 additions & 406 deletions

File tree

tests/integration/goldens/asset/google/cloud/asset_v1/__init__.py

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,71 +24,77 @@
2424
api_core.check_python_version("google.cloud.asset_v1") # type: ignore
2525
api_core.check_dependency_versions("google.cloud.asset_v1") # type: ignore
2626
else: # pragma: NO COVER
27-
# An older version of api_core is installed, which does not define the
27+
# An older version of api_core is installed which does not define the
2828
# functions above. We do equivalent checks manually.
29+
try:
30+
import warnings
31+
import sys
2932

30-
import warnings
31-
import sys
33+
_py_version_str = sys.version.split()[0]
34+
_package_label = "google.cloud.asset_v1"
35+
if sys.version_info < (3, 9):
36+
warnings.warn("You are using a non-supported Python version " +
37+
f"({_py_version_str}). Google will not post any further " +
38+
f"updates to {_package_label} supporting this Python version. " +
39+
"Please upgrade to the latest Python version, or at " +
40+
f"least to Python 3.9, and then update {_package_label}.",
41+
FutureWarning)
42+
if sys.version_info[:2] == (3, 9):
43+
warnings.warn(f"You are using a Python version ({_py_version_str}) " +
44+
f"which Google will stop supporting in {_package_label} in " +
45+
"January 2026. Please " +
46+
"upgrade to the latest Python version, or at " +
47+
"least to Python 3.10, before then, and " +
48+
f"then update {_package_label}.",
49+
FutureWarning)
3250

33-
_py_version_str = sys.version.split()[0]
34-
_package_label = "google.cloud.asset_v1"
35-
if sys.version_info < (3, 9):
36-
warnings.warn("You are using a non-supported Python version " +
37-
f"({_py_version_str}). Google will not post any further " +
38-
f"updates to {_package_label} supporting this Python version. " +
39-
"Please upgrade to the latest Python version, or at " +
40-
f"least to Python 3.9, and then update {_package_label}.",
41-
FutureWarning)
42-
if sys.version_info[:2] == (3, 9):
43-
warnings.warn(f"You are using a Python version ({_py_version_str}) " +
44-
f"which Google will stop supporting in {_package_label} when " +
45-
"it reaches its end of life (October 2025). Please " +
46-
"upgrade to the latest Python version, or at " +
47-
"least Python 3.10, before then, and " +
48-
f"then update {_package_label}.",
49-
FutureWarning)
51+
from packaging.version import parse as parse_version
5052

51-
from packaging.version import parse as parse_version
53+
if sys.version_info < (3, 8):
54+
import pkg_resources
5255

53-
if sys.version_info < (3, 8):
54-
import pkg_resources
55-
56-
def _get_version(dependency_name):
57-
try:
58-
version_string = pkg_resources.get_distribution(dependency_name).version
59-
return (parse_version(version_string), version_string)
60-
except pkg_resources.DistributionNotFound:
61-
return (None, "--")
62-
else:
63-
from importlib import metadata
64-
65-
def _get_version(dependency_name):
66-
try:
67-
version_string = metadata.version("requests")
68-
parsed_version = parse_version(version_string)
69-
return (parsed_version.release, version_string)
70-
except metadata.PackageNotFoundError:
56+
def _get_version(dependency_name):
57+
try:
58+
version_string = pkg_resources.get_distribution(dependency_name).version
59+
return (parse_version(version_string), version_string)
60+
except pkg_resources.DistributionNotFound:
7161
return (None, "--")
62+
else:
63+
from importlib import metadata
64+
65+
def _get_version(dependency_name):
66+
try:
67+
version_string = metadata.version("requests")
68+
parsed_version = parse_version(version_string)
69+
return (parsed_version.release, version_string)
70+
except metadata.PackageNotFoundError:
71+
return (None, "--")
7272

73-
_dependency_package = "google.protobuf"
74-
_next_supported_version = "4.25.8"
75-
_next_supported_version_tuple = (4, 25, 8)
76-
_recommendation = " (we recommend 6.x)"
77-
(_version_used, _version_used_string) = _get_version(_dependency_package)
78-
if _version_used and _version_used < _next_supported_version_tuple:
79-
warnings.warn(f"Package {_package_label} depends on " +
80-
f"{_dependency_package}, currently installed at version " +
81-
f"{_version_used_string}. Future updates to " +
82-
f"{_package_label} will require {_dependency_package} at " +
83-
f"version {_next_supported_version} or higher{_recommendation}." +
84-
" Please ensure " +
85-
"that either (a) your Python environment doesn't pin the " +
86-
f"version of {_dependency_package}, so that updates to " +
87-
f"{_package_label} can require the higher version, or " +
88-
"(b) you manually update your Python environment to use at " +
89-
f"least version {_next_supported_version} of " +
90-
f"{_dependency_package}.",
91-
FutureWarning)
73+
_dependency_package = "google.protobuf"
74+
_next_supported_version = "4.25.8"
75+
_next_supported_version_tuple = (4, 25, 8)
76+
_recommendation = " (we recommend 6.x)"
77+
(_version_used, _version_used_string) = _get_version(_dependency_package)
78+
if _version_used and _version_used < _next_supported_version_tuple:
79+
warnings.warn(f"Package {_package_label} depends on " +
80+
f"{_dependency_package}, currently installed at version " +
81+
f"{_version_used_string}. Future updates to " +
82+
f"{_package_label} will require {_dependency_package} at " +
83+
f"version {_next_supported_version} or higher{_recommendation}." +
84+
" Please ensure " +
85+
"that either (a) your Python environment doesn't pin the " +
86+
f"version of {_dependency_package}, so that updates to " +
87+
f"{_package_label} can require the higher version, or " +
88+
"(b) you manually update your Python environment to use at " +
89+
f"least version {_next_supported_version} of " +
90+
f"{_dependency_package}.",
91+
FutureWarning)
92+
except Exception:
93+
warnings.warn("Could not determine the version of Python " +
94+
"currently being used. To continue receiving " +
95+
"updates for {_package_label}, ensure you are " +
96+
"using a supported version of Python; see " +
97+
"https://devguide.python.org/versions/")
9298

9399

94100
from .services.asset_service import AssetServiceClient

tests/integration/goldens/credentials/google/iam/credentials_v1/__init__.py

Lines changed: 64 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,71 +24,77 @@
2424
api_core.check_python_version("google.iam.credentials_v1") # type: ignore
2525
api_core.check_dependency_versions("google.iam.credentials_v1") # type: ignore
2626
else: # pragma: NO COVER
27-
# An older version of api_core is installed, which does not define the
27+
# An older version of api_core is installed which does not define the
2828
# functions above. We do equivalent checks manually.
29+
try:
30+
import warnings
31+
import sys
2932

30-
import warnings
31-
import sys
33+
_py_version_str = sys.version.split()[0]
34+
_package_label = "google.iam.credentials_v1"
35+
if sys.version_info < (3, 9):
36+
warnings.warn("You are using a non-supported Python version " +
37+
f"({_py_version_str}). Google will not post any further " +
38+
f"updates to {_package_label} supporting this Python version. " +
39+
"Please upgrade to the latest Python version, or at " +
40+
f"least to Python 3.9, and then update {_package_label}.",
41+
FutureWarning)
42+
if sys.version_info[:2] == (3, 9):
43+
warnings.warn(f"You are using a Python version ({_py_version_str}) " +
44+
f"which Google will stop supporting in {_package_label} in " +
45+
"January 2026. Please " +
46+
"upgrade to the latest Python version, or at " +
47+
"least to Python 3.10, before then, and " +
48+
f"then update {_package_label}.",
49+
FutureWarning)
3250

33-
_py_version_str = sys.version.split()[0]
34-
_package_label = "google.iam.credentials_v1"
35-
if sys.version_info < (3, 9):
36-
warnings.warn("You are using a non-supported Python version " +
37-
f"({_py_version_str}). Google will not post any further " +
38-
f"updates to {_package_label} supporting this Python version. " +
39-
"Please upgrade to the latest Python version, or at " +
40-
f"least to Python 3.9, and then update {_package_label}.",
41-
FutureWarning)
42-
if sys.version_info[:2] == (3, 9):
43-
warnings.warn(f"You are using a Python version ({_py_version_str}) " +
44-
f"which Google will stop supporting in {_package_label} when " +
45-
"it reaches its end of life (October 2025). Please " +
46-
"upgrade to the latest Python version, or at " +
47-
"least Python 3.10, before then, and " +
48-
f"then update {_package_label}.",
49-
FutureWarning)
51+
from packaging.version import parse as parse_version
5052

51-
from packaging.version import parse as parse_version
53+
if sys.version_info < (3, 8):
54+
import pkg_resources
5255

53-
if sys.version_info < (3, 8):
54-
import pkg_resources
55-
56-
def _get_version(dependency_name):
57-
try:
58-
version_string = pkg_resources.get_distribution(dependency_name).version
59-
return (parse_version(version_string), version_string)
60-
except pkg_resources.DistributionNotFound:
61-
return (None, "--")
62-
else:
63-
from importlib import metadata
64-
65-
def _get_version(dependency_name):
66-
try:
67-
version_string = metadata.version("requests")
68-
parsed_version = parse_version(version_string)
69-
return (parsed_version.release, version_string)
70-
except metadata.PackageNotFoundError:
56+
def _get_version(dependency_name):
57+
try:
58+
version_string = pkg_resources.get_distribution(dependency_name).version
59+
return (parse_version(version_string), version_string)
60+
except pkg_resources.DistributionNotFound:
7161
return (None, "--")
62+
else:
63+
from importlib import metadata
64+
65+
def _get_version(dependency_name):
66+
try:
67+
version_string = metadata.version("requests")
68+
parsed_version = parse_version(version_string)
69+
return (parsed_version.release, version_string)
70+
except metadata.PackageNotFoundError:
71+
return (None, "--")
7272

73-
_dependency_package = "google.protobuf"
74-
_next_supported_version = "4.25.8"
75-
_next_supported_version_tuple = (4, 25, 8)
76-
_recommendation = " (we recommend 6.x)"
77-
(_version_used, _version_used_string) = _get_version(_dependency_package)
78-
if _version_used and _version_used < _next_supported_version_tuple:
79-
warnings.warn(f"Package {_package_label} depends on " +
80-
f"{_dependency_package}, currently installed at version " +
81-
f"{_version_used_string}. Future updates to " +
82-
f"{_package_label} will require {_dependency_package} at " +
83-
f"version {_next_supported_version} or higher{_recommendation}." +
84-
" Please ensure " +
85-
"that either (a) your Python environment doesn't pin the " +
86-
f"version of {_dependency_package}, so that updates to " +
87-
f"{_package_label} can require the higher version, or " +
88-
"(b) you manually update your Python environment to use at " +
89-
f"least version {_next_supported_version} of " +
90-
f"{_dependency_package}.",
91-
FutureWarning)
73+
_dependency_package = "google.protobuf"
74+
_next_supported_version = "4.25.8"
75+
_next_supported_version_tuple = (4, 25, 8)
76+
_recommendation = " (we recommend 6.x)"
77+
(_version_used, _version_used_string) = _get_version(_dependency_package)
78+
if _version_used and _version_used < _next_supported_version_tuple:
79+
warnings.warn(f"Package {_package_label} depends on " +
80+
f"{_dependency_package}, currently installed at version " +
81+
f"{_version_used_string}. Future updates to " +
82+
f"{_package_label} will require {_dependency_package} at " +
83+
f"version {_next_supported_version} or higher{_recommendation}." +
84+
" Please ensure " +
85+
"that either (a) your Python environment doesn't pin the " +
86+
f"version of {_dependency_package}, so that updates to " +
87+
f"{_package_label} can require the higher version, or " +
88+
"(b) you manually update your Python environment to use at " +
89+
f"least version {_next_supported_version} of " +
90+
f"{_dependency_package}.",
91+
FutureWarning)
92+
except Exception:
93+
warnings.warn("Could not determine the version of Python " +
94+
"currently being used. To continue receiving " +
95+
"updates for {_package_label}, ensure you are " +
96+
"using a supported version of Python; see " +
97+
"https://devguide.python.org/versions/")
9298

9399

94100
from .services.iam_credentials import IAMCredentialsClient

0 commit comments

Comments
 (0)