Skip to content

Commit aea1f78

Browse files
chore: add missing import in owlbot.py (#152)
* chore: add missing import in owlbot.py * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent bae2d11 commit aea1f78

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

cloudbuild/snippets/noxfile.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
# WARNING - WARNING - WARNING - WARNING - WARNING
2929
# WARNING - WARNING - WARNING - WARNING - WARNING
3030

31-
# Copy `noxfile_config.py` to your directory and modify it instead.
31+
BLACK_VERSION = "black==19.10b0"
3232

33+
# Copy `noxfile_config.py` to your directory and modify it instead.
3334

3435
# `TEST_CONFIG` dict is a configuration hook that allows users to
3536
# modify the test configurations. The values here should be in sync
@@ -38,7 +39,7 @@
3839

3940
TEST_CONFIG = {
4041
# You can opt out from the test for specific Python versions.
41-
'ignored_versions': ["2.7"],
42+
'ignored_versions': [],
4243

4344
# Old samples are opted out of enforcing Python type hints
4445
# All new samples should feature them
@@ -50,7 +51,10 @@
5051
# to use your own Cloud project.
5152
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
5253
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
53-
54+
# If you need to use a specific version of pip,
55+
# change pip_version_override to the string representation
56+
# of the version number, for example, "20.2.4"
57+
"pip_version_override": None,
5458
# A dictionary you want to inject into your test. Don't put any
5559
# secrets here. These values will override predefined values.
5660
'envs': {},
@@ -84,15 +88,15 @@ def get_pytest_env_vars() -> Dict[str, str]:
8488

8589

8690
# DO NOT EDIT - automatically generated.
87-
# All versions used to tested samples.
88-
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
91+
# All versions used to test samples.
92+
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
8993

9094
# Any default versions that should be ignored.
9195
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
9296

9397
TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
9498

95-
INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
99+
INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
96100
#
97101
# Style Checks
98102
#
@@ -156,7 +160,7 @@ def lint(session: nox.sessions.Session) -> None:
156160

157161
@nox.session
158162
def blacken(session: nox.sessions.Session) -> None:
159-
session.install("black")
163+
session.install(BLACK_VERSION)
160164
python_files = [path for path in os.listdir(".") if path.endswith(".py")]
161165

162166
session.run("black", *python_files)
@@ -170,12 +174,21 @@ def blacken(session: nox.sessions.Session) -> None:
170174

171175

172176
def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
177+
if TEST_CONFIG["pip_version_override"]:
178+
pip_version = TEST_CONFIG["pip_version_override"]
179+
session.install(f"pip=={pip_version}")
173180
"""Runs py.test for a particular project."""
174181
if os.path.exists("requirements.txt"):
175-
session.install("-r", "requirements.txt")
182+
if os.path.exists("constraints.txt"):
183+
session.install("-r", "requirements.txt", "-c", "constraints.txt")
184+
else:
185+
session.install("-r", "requirements.txt")
176186

177187
if os.path.exists("requirements-test.txt"):
178-
session.install("-r", "requirements-test.txt")
188+
if os.path.exists("constraints-test.txt"):
189+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
190+
else:
191+
session.install("-r", "requirements-test.txt")
179192

180193
if INSTALL_LIBRARY_FROM_SOURCE:
181194
session.install("-e", _get_repo_root())

0 commit comments

Comments
 (0)