-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add prerelease session to test with latest dependencies, separate compliance tests #401
Changes from 15 commits
dfe4fc2
01aca60
0625f3d
93b3286
211cc2b
efdceac
dea0707
12900cb
1605357
31bb104
288a11d
4e42d8b
6ee316f
4d22f16
0da9200
74630c0
2b77257
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Only run this nox session. | ||
env_vars: { | ||
key: "NOX_SESSION" | ||
value: "compliance" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Only run this nox session. | ||
env_vars: { | ||
key: "NOX_SESSION" | ||
value: "prerelease" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Only run this nox session. | ||
env_vars: { | ||
key: "NOX_SESSION" | ||
value: "compliance" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Format: //devtools/kokoro/config/proto/build.proto | ||
|
||
# Only run this nox session. | ||
env_vars: { | ||
key: "NOX_SESSION" | ||
value: "prerelease" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
from __future__ import absolute_import | ||
import os | ||
import pathlib | ||
import re | ||
import shutil | ||
|
||
import nox | ||
|
@@ -37,11 +38,10 @@ | |
|
||
# 'docfx' is excluded since it only needs to run in 'docs-presubmit' | ||
nox.options.sessions = [ | ||
"lint", | ||
"unit", | ||
"cover", | ||
"system", | ||
"compliance", | ||
"cover", | ||
"lint", | ||
"lint_setup_py", | ||
"blacken", | ||
"docs", | ||
|
@@ -183,7 +183,76 @@ def system(session): | |
) | ||
|
||
|
||
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) | ||
@nox.session(python=DEFAULT_PYTHON_VERSION) | ||
def prerelease(session): | ||
session.install( | ||
"--prefer-binary", | ||
"--pre", | ||
"--upgrade", | ||
"alembic", | ||
"geoalchemy2", | ||
"google-api-core", | ||
"google-cloud-bigquery", | ||
"google-cloud-bigquery-storage", | ||
"google-cloud-core", | ||
"google-resumable-media", | ||
"grpcio", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These 4 don't appear in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point. Possibly we should add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mailed #414 which updates some of the dependencies in |
||
"sqlalchemy", | ||
"shapely", | ||
) | ||
session.install( | ||
"freezegun", | ||
"google-cloud-testutils", | ||
"mock", | ||
"psutil", | ||
"pytest", | ||
"pytest-cov", | ||
"pytz", | ||
) | ||
|
||
# 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. | ||
deps = [ | ||
match.group(1) | ||
for match in re.finditer( | ||
r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE | ||
) | ||
] | ||
|
||
# We use --no-deps to ensure that pre-release versions aren't overwritten | ||
# by the version ranges in setup.py. | ||
session.install(*deps) | ||
session.install("--no-deps", "-e", ".") | ||
|
||
# Print out prerelease package versions. | ||
session.run("python", "-m", "pip", "freeze") | ||
|
||
# Run all tests, except a few samples tests which require extra dependencies. | ||
session.run( | ||
"py.test", | ||
"--quiet", | ||
f"--junitxml=prerelease_unit_{session.python}_sponge_log.xml", | ||
os.path.join("tests", "unit"), | ||
) | ||
session.run( | ||
"py.test", | ||
"--quiet", | ||
f"--junitxml=prerelease_system_{session.python}_sponge_log.xml", | ||
os.path.join("tests", "system"), | ||
) | ||
|
||
|
||
@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS[-1]) | ||
def compliance(session): | ||
"""Run the SQLAlchemy dialect-compliance system tests""" | ||
constraints_path = str( | ||
|
@@ -193,8 +262,6 @@ def compliance(session): | |
|
||
if os.environ.get("RUN_COMPLIANCE_TESTS", "true") == "false": | ||
session.skip("RUN_COMPLIANCE_TESTS is set to false, skipping") | ||
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): | ||
session.skip("Credentials must be set via environment variable") | ||
if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": | ||
session.install("pyopenssl") | ||
if not os.path.exists(system_test_folder_path): | ||
|
@@ -204,7 +271,9 @@ def compliance(session): | |
|
||
session.install( | ||
"mock", | ||
"pytest", | ||
# TODO: Allow latest version of pytest once SQLAlchemy 1.4.28+ is supported. | ||
# See: https://github.com/googleapis/python-bigquery-sqlalchemy/issues/413 | ||
"pytest<=7.0.0dev", | ||
"pytest-rerunfailures", | ||
"google-cloud-testutils", | ||
"-c", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Mostly taken straight from https://github.com/googleapis/python-bigquery-pandas/blob/d4539747848156446d8a3ccdb49661e72ae03109/noxfile.py#L176
googleapis/synthtool#1290 is open to add this to the templates, though it would need to be slightly templated to allow for customized prerelease dependencies.