Skip to content

Commit 71784d3

Browse files
chore: add prerelease nox session (#327)
Source-Link: googleapis/synthtool@050953d Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent fb00386 commit 71784d3

4 files changed

Lines changed: 80 additions & 2 deletions

File tree

packages/google-cloud-datastore/.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:65e656411895bff71cffcae97246966460160028f253c2e45b7a25d805a5b142
17+
# created: 2022-06-12T13:11:45.905884945Z
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-datastore/noxfile.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,3 +359,67 @@ def docfx(session):
359359
os.path.join("docs", ""),
360360
os.path.join("docs", "_build", "html", ""),
361361
)
362+
363+
364+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
365+
def prerelease_deps(session):
366+
"""Run all tests with prerelease versions of dependencies installed."""
367+
368+
prerel_deps = [
369+
"protobuf",
370+
"googleapis-common-protos",
371+
"google-auth",
372+
"grpcio",
373+
"grpcio-status",
374+
"google-api-core",
375+
"proto-plus",
376+
# dependencies of google-auth
377+
"cryptography",
378+
"pyasn1",
379+
]
380+
381+
for dep in prerel_deps:
382+
session.install("--pre", "--no-deps", "--upgrade", dep)
383+
384+
# Remaining dependencies
385+
other_deps = ["requests"]
386+
session.install(*other_deps)
387+
388+
session.install(*UNIT_TEST_STANDARD_DEPENDENCIES)
389+
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES)
390+
391+
# Because we test minimum dependency versions on the minimum Python
392+
# version, the first version we test with in the unit tests sessions has a
393+
# constraints file containing all dependencies and extras.
394+
with open(
395+
CURRENT_DIRECTORY
396+
/ "testing"
397+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
398+
encoding="utf-8",
399+
) as constraints_file:
400+
constraints_text = constraints_file.read()
401+
402+
# Ignore leading whitespace and comment lines.
403+
deps = [
404+
match.group(1)
405+
for match in re.finditer(
406+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
407+
)
408+
]
409+
410+
# Don't overwrite prerelease packages.
411+
deps = [dep for dep in deps if dep not in prerel_deps]
412+
# We use --no-deps to ensure that pre-release versions aren't overwritten
413+
# by the version ranges in setup.py.
414+
session.install(*deps)
415+
session.install("--no-deps", "-e", ".[all]")
416+
417+
# Print out prerelease package versions
418+
session.run(
419+
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
420+
)
421+
session.run("python", "-c", "import grpc; print(grpc.__version__)")
422+
423+
session.run("py.test", "tests/unit")
424+
session.run("py.test", "tests/system")
425+
session.run("py.test", "samples/snippets")

0 commit comments

Comments
 (0)