Skip to content

Commit

Permalink
chore(python): exclude grpcio==1.49.0rc1 in tests (#1618)
Browse files Browse the repository at this point in the history
* chore(python): exclude `grpcio==1.49.0rc1` in tests

Source-Link: googleapis/synthtool@c4dd595
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72

* revert changes

* 🦉 Updates from OwlBot post-processor

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>
Co-authored-by: Anthonios Partheniou <[email protected]>
  • Loading branch information
3 people authored Aug 30, 2022
1 parent d591d3e commit 484e416
Show file tree
Hide file tree
Showing 11 changed files with 579 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/.OwlBot.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.
docker:
image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest
digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32
# created: 2022-05-05T22:08:23.383410683Z
digest: sha256:ce3c1686bc81145c81dd269bd12c4025c6b275b22d14641358827334fddb1d72
# created: 2022-08-29T17:28:30.441852797Z
4 changes: 1 addition & 3 deletions .kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ export PYTHONUNBUFFERED=1
export PATH="${HOME}/.local/bin:${PATH}"

# Install nox
python3 -m pip install --user --upgrade --quiet nox
python3 -m pip install --require-hashes -r .kokoro/requirements.txt
python3 -m nox --version

# build docs
nox -s docs

python3 -m pip install --user gcp-docuploader

# create metadata
python3 -m docuploader create-metadata \
--name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
Expand Down
5 changes: 1 addition & 4 deletions .kokoro/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
set -eo pipefail

# Start the releasetool reporter
python3 -m pip install gcp-releasetool
python3 -m pip install --require-hashes -r .kokoro/requirements.txt
python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script

# Ensure that we have the latest versions of Twine, Wheel, and Setuptools.
python3 -m pip install --upgrade twine wheel setuptools

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

Expand Down
8 changes: 8 additions & 0 deletions .kokoro/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gcp-docuploader
gcp-releasetool
importlib-metadata
typing-extensions
twine
wheel
setuptools
nox
464 changes: 464 additions & 0 deletions .kokoro/requirements.txt

Large diffs are not rendered by default.

96 changes: 95 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from __future__ import absolute_import
import os
import pathlib
import re
import shutil
import warnings

Expand Down Expand Up @@ -190,7 +191,9 @@ def unit(session):
def install_systemtest_dependencies(session, *constraints):

# Use pre-release gRPC for system tests.
session.install("--pre", "grpcio")
# Exclude version 1.49.0rc1 which has a known issue.
# See https://github.com/grpc/grpc/pull/30642
session.install("--pre", "grpcio!=1.49.0rc1")

session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)

Expand Down Expand Up @@ -326,3 +329,94 @@ def docfx(session):
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)


@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
def prerelease_deps(session):
"""Run all tests with prerelease versions of dependencies installed."""

# Install all dependencies
session.install("-e", ".[all, tests, tracing]")
unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
session.install(*unit_deps_all)
system_deps_all = (
SYSTEM_TEST_STANDARD_DEPENDENCIES
+ SYSTEM_TEST_EXTERNAL_DEPENDENCIES
+ SYSTEM_TEST_EXTRAS
)
session.install(*system_deps_all)

# Because we test minimum dependency versions on the minimum Python
# version, the first version we test with in the unit tests sessions has a
# constraints file containing all dependencies and extras.
with open(
CURRENT_DIRECTORY
/ "testing"
/ f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
encoding="utf-8",
) as constraints_file:
constraints_text = constraints_file.read()

# Ignore leading whitespace and comment lines.
constraints_deps = [
match.group(1)
for match in re.finditer(
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
)
]

session.install(*constraints_deps)

prerel_deps = [
"protobuf",
# dependency of grpc
"six",
"googleapis-common-protos",
# Exclude version 1.49.0rc1 which has a known issue. See https://github.com/grpc/grpc/pull/30642
"grpcio!=1.49.0rc1",
"grpcio-status",
"google-api-core",
"proto-plus",
"google-cloud-testutils",
# dependencies of google-cloud-testutils"
"click",
]

for dep in prerel_deps:
session.install("--pre", "--no-deps", "--upgrade", dep)

# Remaining dependencies
other_deps = [
"requests",
"google-auth",
]
session.install(*other_deps)

# Print out prerelease package versions
session.run(
"python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
)
session.run("python", "-c", "import grpc; print(grpc.__version__)")

session.run("py.test", "tests/unit")

system_test_path = os.path.join("tests", "system.py")
system_test_folder_path = os.path.join("tests", "system")

# Only run system tests if found.
if os.path.exists(system_test_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
)
if os.path.exists(system_test_folder_path):
session.run(
"py.test",
"--verbose",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
)
6 changes: 4 additions & 2 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,17 @@
".coveragerc",
".kokoro/continuous/common.cfg",
".kokoro/presubmit/presubmit.cfg",
".kokoro/continuous/prerelease-deps.cfg",
".kokoro/presubmit/prerelease-deps.cfg",
# exclude sample configs so periodic samples are tested against main
# instead of pypi
".kokoro/samples/python3.6/periodic.cfg",
".kokoro/samples/python3.7/periodic.cfg",
".kokoro/samples/python3.8/periodic.cfg",
".kokoro/samples/python3.9/periodic.cfg",
".kokoro/samples/python3.10/periodic.cfg",
".github/CODEOWNERS",
".github/workflows", # exclude gh actions as credentials are needed for tests
"README.rst",
],
) # the microgenerator has a good coveragerc file

Expand All @@ -130,7 +132,7 @@

s.replace(
".kokoro/test-samples-impl.sh",
"python3.6",
"python3.9",
"python3",
)

Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
":preserveSemverRanges",
":disableDependencyDashboard"
],
"ignorePaths": [".pre-commit-config.yaml"],
"ignorePaths": [".pre-commit-config.yaml", ".kokoro/requirements.txt"],
"pip_requirements": {
"fileMatch": ["requirements-test.txt", "samples/[\\S/]*constraints.txt", "samples/[\\S/]*constraints-test.txt"]
}
Expand Down
2 changes: 1 addition & 1 deletion samples/model-builder/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:

# DO NOT EDIT - automatically generated.
# All versions used to test samples.
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:

# DO NOT EDIT - automatically generated.
# All versions used to test samples.
ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
Expand Down
2 changes: 1 addition & 1 deletion scripts/readme-gen/templates/install_deps.tmpl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Install Dependencies
.. _Python Development Environment Setup Guide:
https://cloud.google.com/python/setup

#. Create a virtualenv. Samples are compatible with Python 3.6+.
#. Create a virtualenv. Samples are compatible with Python 3.7+.

.. code-block:: bash
Expand Down

0 comments on commit 484e416

Please sign in to comment.