Skip to content

Commit 39a2cfe

Browse files
chore: add prerelease nox session (#128)
Source-Link: googleapis/synthtool@d2871d9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 60a152e commit 39a2cfe

File tree

4 files changed

+81
-2
lines changed

4 files changed

+81
-2
lines changed

packages/google-cloud-private-catalog/.github/.OwlBot.lock.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
# limitations under the License.
1414
docker:
1515
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
16-
digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
17-
# created: 2022-05-05T22:08:23.383410683Z
16+
digest: sha256:b2dc5f80edcf5d4486c39068c9fa11f7f851d9568eea4dcba130f994ea9b5e97
17+
# created: 2022-06-12T16:09:31.61859086Z
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "prerelease_deps"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Only run this nox session.
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "prerelease_deps"
7+
}

packages/google-cloud-private-catalog/noxfile.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import os
2222
import pathlib
23+
import re
2324
import shutil
2425
import warnings
2526

@@ -325,3 +326,67 @@ def docfx(session):
325326
os.path.join("docs", ""),
326327
os.path.join("docs", "_build", "html", ""),
327328
)
329+
330+
331+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
332+
def prerelease_deps(session):
333+
"""Run all tests with prerelease versions of dependencies installed."""
334+
335+
prerel_deps = [
336+
"protobuf",
337+
"googleapis-common-protos",
338+
"google-auth",
339+
"grpcio",
340+
"grpcio-status",
341+
"google-api-core",
342+
"proto-plus",
343+
# dependencies of google-auth
344+
"cryptography",
345+
"pyasn1",
346+
]
347+
348+
for dep in prerel_deps:
349+
session.install("--pre", "--no-deps", "--upgrade", dep)
350+
351+
# Remaining dependencies
352+
other_deps = ["requests"]
353+
session.install(*other_deps)
354+
355+
session.install(*UNIT_TEST_STANDARD_DEPENDENCIES)
356+
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES)
357+
358+
# Because we test minimum dependency versions on the minimum Python
359+
# version, the first version we test with in the unit tests sessions has a
360+
# constraints file containing all dependencies and extras.
361+
with open(
362+
CURRENT_DIRECTORY
363+
/ "testing"
364+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
365+
encoding="utf-8",
366+
) as constraints_file:
367+
constraints_text = constraints_file.read()
368+
369+
# Ignore leading whitespace and comment lines.
370+
deps = [
371+
match.group(1)
372+
for match in re.finditer(
373+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
374+
)
375+
]
376+
377+
# Don't overwrite prerelease packages.
378+
deps = [dep for dep in deps if dep not in prerel_deps]
379+
# We use --no-deps to ensure that pre-release versions aren't overwritten
380+
# by the version ranges in setup.py.
381+
session.install(*deps)
382+
session.install("--no-deps", "-e", ".[all]")
383+
384+
# Print out prerelease package versions
385+
session.run(
386+
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
387+
)
388+
session.run("python", "-c", "import grpc; print(grpc.__version__)")
389+
390+
session.run("py.test", "tests/unit")
391+
session.run("py.test", "tests/system")
392+
session.run("py.test", "samples/snippets")

0 commit comments

Comments
 (0)