Skip to content

Commit 9fb6f2f

Browse files
chore: add constraints file check for python samples (#601)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/b7a528df-1b0b-42e0-a583-e53b45ee05fc/targets - [ ] To automatically regenerate this PR, check this box. (May take up to 24 hours.) Source-Link: googleapis/synthtool@0a071b3
1 parent dde9dc5 commit 9fb6f2f

File tree

5 files changed

+24
-9
lines changed

5 files changed

+24
-9
lines changed

.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",

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
}

samples/geography/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,16 @@ def _session_tests(
174174
) -> None:
175175
"""Runs py.test for a particular project."""
176176
if os.path.exists("requirements.txt"):
177-
session.install("-r", "requirements.txt")
177+
if os.path.exists("constraints.txt"):
178+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
179+
else:
180+
session.install("-r", "requirements.txt")
178181

179182
if os.path.exists("requirements-test.txt"):
180-
session.install("-r", "requirements-test.txt")
183+
if os.path.exists("constraints-test.txt"):
184+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
185+
else:
186+
session.install("-r", "requirements-test.txt")
181187

182188
if INSTALL_LIBRARY_FROM_SOURCE:
183189
session.install("-e", _get_repo_root())

samples/snippets/noxfile.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,16 @@ def _session_tests(
174174
) -> None:
175175
"""Runs py.test for a particular project."""
176176
if os.path.exists("requirements.txt"):
177-
session.install("-r", "requirements.txt")
177+
if os.path.exists("constraints.txt"):
178+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
179+
else:
180+
session.install("-r", "requirements.txt")
178181

179182
if os.path.exists("requirements-test.txt"):
180-
session.install("-r", "requirements-test.txt")
183+
if os.path.exists("constraints-test.txt"):
184+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
185+
else:
186+
session.install("-r", "requirements-test.txt")
181187

182188
if INSTALL_LIBRARY_FROM_SOURCE:
183189
session.install("-e", _get_repo_root())

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-bigquery.git",
7-
"sha": "c1195147a6e9220f26558a301427dd447646da3a"
7+
"sha": "8f4c0b84dac3840532d7865247b8ad94b625b897"
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)