Skip to content

Commit 823eb31

Browse files
chore: add constraints file check for python samples (#118)
* chore: add constraints file check for python samples This is the sibling PR to GoogleCloudPlatform/python-docs-samples#5611 and this is the issue opened for it GoogleCloudPlatform/python-docs-samples#5549
1 parent 9437883 commit 823eb31

File tree

7 files changed

+34
-13
lines changed

7 files changed

+34
-13
lines changed

packages/google-cloud-monitoring/.github/header-checker-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{"allowedCopyrightHolders": ["Google LLC"],
22
"allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
3-
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt"],
3+
"ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
44
"sourceFileExtensions": [
55
"ts",
66
"js",

packages/google-cloud-monitoring/google/cloud/monitoring_v3/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@
185185
"ListUptimeCheckConfigsResponse",
186186
"ListUptimeCheckIpsRequest",
187187
"ListUptimeCheckIpsResponse",
188+
"MetricServiceClient",
188189
"MutationRecord",
189190
"NotificationChannel",
190191
"NotificationChannelDescriptor",
@@ -220,8 +221,7 @@
220221
"UptimeCheckConfig",
221222
"UptimeCheckIp",
222223
"UptimeCheckRegion",
223-
"UptimeCheckServiceClient",
224224
"VerifyNotificationChannelRequest",
225225
"WindowsBasedSli",
226-
"MetricServiceClient",
226+
"UptimeCheckServiceClient",
227227
)

packages/google-cloud-monitoring/renovate.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
"extends": [
33
"config:base", ":preserveSemverRanges"
44
],
5-
"ignorePaths": [".pre-commit-config.yaml"]
5+
"ignorePaths": [".pre-commit-config.yaml"],
6+
"pip_requirements": {
7+
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
8+
}
69
}

packages/google-cloud-monitoring/samples/snippets/v3/alerts-client/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None:
172172
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
173173
"""Runs py.test for a particular project."""
174174
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
175+
if os.path.exists("constraints.txt"):
176+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
177+
else:
178+
session.install("-r", "requirements.txt")
176179

177180
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
181+
if os.path.exists("constraints-test.txt"):
182+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
183+
else:
184+
session.install("-r", "requirements-test.txt")
179185

180186
if INSTALL_LIBRARY_FROM_SOURCE:
181187
session.install("-e", _get_repo_root())

packages/google-cloud-monitoring/samples/snippets/v3/cloud-client/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None:
172172
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
173173
"""Runs py.test for a particular project."""
174174
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
175+
if os.path.exists("constraints.txt"):
176+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
177+
else:
178+
session.install("-r", "requirements.txt")
176179

177180
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
181+
if os.path.exists("constraints-test.txt"):
182+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
183+
else:
184+
session.install("-r", "requirements-test.txt")
179185

180186
if INSTALL_LIBRARY_FROM_SOURCE:
181187
session.install("-e", _get_repo_root())

packages/google-cloud-monitoring/samples/snippets/v3/uptime-check-client/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,16 @@ def blacken(session: nox.sessions.Session) -> None:
172172
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
173173
"""Runs py.test for a particular project."""
174174
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
175+
if os.path.exists("constraints.txt"):
176+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
177+
else:
178+
session.install("-r", "requirements.txt")
176179

177180
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
181+
if os.path.exists("constraints-test.txt"):
182+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
183+
else:
184+
session.install("-r", "requirements-test.txt")
179185

180186
if INSTALL_LIBRARY_FROM_SOURCE:
181187
session.install("-e", _get_repo_root())

packages/google-cloud-monitoring/synth.metadata

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/python-monitoring.git",
7-
"sha": "dc5a7f8566b99b73d1f3bfc01d97f14bb237f3c4"
7+
"sha": "a0261c98d42ed550dc068fa2fd606b9150d54b2b"
88
}
99
},
1010
{
@@ -19,14 +19,14 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
22+
"sha": "0a071b3460344886297a304253bf924aa68ddb7e"
2323
}
2424
},
2525
{
2626
"git": {
2727
"name": "synthtool",
2828
"remote": "https://github.com/googleapis/synthtool.git",
29-
"sha": "5b5bf6d519b2d658d9f2e483d9f6f3d0ba8ee6bc"
29+
"sha": "0a071b3460344886297a304253bf924aa68ddb7e"
3030
}
3131
}
3232
],

0 commit comments

Comments
 (0)