Skip to content

Commit c019b9e

Browse files
chore: add prerelease nox session (#608)
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 bba611d commit c019b9e

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

packages/google-cloud-firestore/.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-firestore/noxfile.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,67 @@ def docfx(session):
400400
os.path.join("docs", ""),
401401
os.path.join("docs", "_build", "html", ""),
402402
)
403+
404+
405+
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
406+
def prerelease_deps(session):
407+
"""Run all tests with prerelease versions of dependencies installed."""
408+
409+
prerel_deps = [
410+
"protobuf",
411+
"googleapis-common-protos",
412+
"google-auth",
413+
"grpcio",
414+
"grpcio-status",
415+
"google-api-core",
416+
"proto-plus",
417+
# dependencies of google-auth
418+
"cryptography",
419+
"pyasn1",
420+
]
421+
422+
for dep in prerel_deps:
423+
session.install("--pre", "--no-deps", "--upgrade", dep)
424+
425+
# Remaining dependencies
426+
other_deps = ["requests"]
427+
session.install(*other_deps)
428+
429+
session.install(*UNIT_TEST_STANDARD_DEPENDENCIES)
430+
session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES)
431+
432+
# Because we test minimum dependency versions on the minimum Python
433+
# version, the first version we test with in the unit tests sessions has a
434+
# constraints file containing all dependencies and extras.
435+
with open(
436+
CURRENT_DIRECTORY
437+
/ "testing"
438+
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
439+
encoding="utf-8",
440+
) as constraints_file:
441+
constraints_text = constraints_file.read()
442+
443+
# Ignore leading whitespace and comment lines.
444+
deps = [
445+
match.group(1)
446+
for match in re.finditer(
447+
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
448+
)
449+
]
450+
451+
# Don't overwrite prerelease packages.
452+
deps = [dep for dep in deps if dep not in prerel_deps]
453+
# We use --no-deps to ensure that pre-release versions aren't overwritten
454+
# by the version ranges in setup.py.
455+
session.install(*deps)
456+
session.install("--no-deps", "-e", ".[all]")
457+
458+
# Print out prerelease package versions
459+
session.run(
460+
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
461+
)
462+
session.run("python", "-c", "import grpc; print(grpc.__version__)")
463+
464+
session.run("py.test", "tests/unit")
465+
session.run("py.test", "tests/system")
466+
session.run("py.test", "samples/snippets")

0 commit comments

Comments
 (0)