-
Notifications
You must be signed in to change notification settings - Fork 30
feat: Stage 6 of nox
implementation - enabling system tests
#480
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
Changes from 4 commits
7d9b571
e11e653
1b70ce4
9102cfc
106a295
8158927
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 |
---|---|---|
|
@@ -87,6 +87,43 @@ def unit(session): | |
default(session) | ||
|
||
|
||
@nox.session(python="3.8") | ||
def system(session): | ||
"""Run the system test suite.""" | ||
system_test_path = os.path.join("tests", "system.py") | ||
system_test_folder_path = os.path.join("tests", "system") | ||
|
||
# Sanity check: Only run tests if the environment variable is set. | ||
if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): | ||
session.skip("Credentials must be set via environment variable") | ||
|
||
system_test_exists = os.path.exists(system_test_path) | ||
system_test_folder_exists = os.path.exists(system_test_folder_path) | ||
|
||
# Sanity check: only run tests if found. | ||
if not system_test_exists and not system_test_folder_exists: | ||
session.skip("System tests were not found") | ||
|
||
# Install dependencies, e.g.: | ||
# session.install("google-cloud-iam") | ||
# Use pre-release gRPC for system tests. | ||
# session.install("--pre", "grpcio") | ||
|
||
# Install all test dependencies, then install this package into the | ||
# virtualenv's dist-packages. | ||
session.install("mock", "pytest") | ||
session.install("-e", ".") | ||
session.install("-e", "test_utils") | ||
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. If any of the system tests need the contents of test_utils, you can install it through pip. It might not be necessary though (there's not too much in it (https://github.com/googleapis/python-test-utils/tree/master/test_utils) at this point.
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. @busunkim96 👍 Agreed. This way used to be prevalent across other products and still exists in Spanner, Bigtable, and possibly some others. Would it be a good idea to update those as well? |
||
|
||
# Run py.test against the system tests. | ||
if system_test_exists: | ||
session.run("py.test", "--quiet", system_test_path, *session.posargs) | ||
if system_test_folder_exists: | ||
session.run( | ||
"py.test", "--quiet", system_test_folder_path, *session.posargs | ||
) | ||
|
||
|
||
@nox.session(python="3.8") | ||
def cover(session): | ||
"""Run the final coverage report. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
U2FsdGVkX1/vVm/dOEg1DCACYbdOcL+ey6+64A+DZGZVgF8Z/3skK6rpPocu6GOA | ||
UZAqASsBH9QifDf8cKVXQXVYpYq6HSv2O0w7vOmVorZO9GYPo98s9/8XO+4ty/AU | ||
aB6TD68frBAYv4cT/l5m7aYdzfzMTy0EOXoleZT09JYP3B5FV3KCO114FzMXGwrj | ||
HXsR6E5SyUUlUnWPC3eD3aqmovay0gxOKYO3ZwjFK1nlbN/8q6/8nwBCf/Bg6SHV | ||
V93pNxdolRlJev9kgKz4RN1z4jGCy5PAndhSLE82NFIs9LoAiEOU5YeMlN+Ulqus | ||
J92nh+ptUe9a4pJGbAuveUWO7zdS1QyXvTMUcmmSfXCNm/eIQjNuu5+rHtIjWKh8 | ||
Ilwj2w1aTfSptQEhk/kwRgFz/d11vfwJzvwTmCxO6zyOeL0VUWLqdCBGgG5As9He | ||
/RenF8PZ1O0WbTt7fns5oTlTk/MUo+0xJ1xqvu/y45LaqqcBAnEdrWKmtM3dJHWv | ||
ufQku+kD+83F/VwBnQdvgMHu6KZEs6LRrNo58r4QuK6fS7VCACdzxID1RM2cL7kT | ||
6BFRlyGj1aigmjne9g9M9Jx4R+mZDpPU1WDzzG71J4qCUwaX8Dfwutuv4uiFvzwq | ||
NUF0wLJJPtKWmtW+hnZ/fhHQGCRsOpZzFnqp6Zv7J7k6esqxMgIjfal7Djk5Acy8 | ||
j3iVvm6CYmKMVqzL62JHYS9Ye83tzBCaR8hpnJQKgH3FSOFY8HSwrtQSIsl/hSeF | ||
41sgnz0Y+/gkzNeU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s3lvYtofvE | ||
8DxztdTidQedNVNE+63YCjhxd/cZUI5n/UpgYkr9owp7hNGJiR3tdoNLR2gcoGqL | ||
qWhH928k2aSgF2j97LZ2OqoPCp0tUB7ho4jD2u4Ik3GLVNlCc3dCvWRvpHtDTQDv | ||
tujESMfHUc9I2r4S/PD3bku/ABGwa977Yp1PjzJGr9RajA5is5n6GVpyynwjtKG4 | ||
iyyITpdwpCgr8pueTBLwZnas3slmiMOog/E4PmPgctHzvC+vhQijhUtw5zSsmv0l | ||
bZlw/mVhp5Ta7dTcLBKR8DA3m3vTbaEGkz0xpfQr7GfiSMRbJyvIw88pDK0gyTMD |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Copyright 2016 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
"""Helper to determine package from tag. | ||
Get the current package directory corresponding to the Circle Tag. | ||
""" | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
import re | ||
import sys | ||
|
||
|
||
TAG_RE = re.compile(r""" | ||
^ | ||
(?P<pkg> | ||
(([a-z]+)[_-])*) # pkg-name-with-hyphens-or-underscores (empty allowed) | ||
([0-9]+)\.([0-9]+)\.([0-9]+) # Version x.y.z (x, y, z all ints) | ||
$ | ||
""", re.VERBOSE) | ||
TAG_ENV = 'CIRCLE_TAG' | ||
ERROR_MSG = '%s env. var. not set' % (TAG_ENV,) | ||
BAD_TAG_MSG = 'Invalid tag name: %s. Expected pkg-name-x.y.z' | ||
CIRCLE_CI_SCRIPTS_DIR = os.path.dirname(__file__) | ||
ROOT_DIR = os.path.realpath( | ||
os.path.join(CIRCLE_CI_SCRIPTS_DIR, '..', '..', '..')) | ||
|
||
|
||
def main(): | ||
"""Get the current package directory. | ||
Prints the package directory out so callers can consume it. | ||
""" | ||
if TAG_ENV not in os.environ: | ||
print(ERROR_MSG, file=sys.stderr) | ||
sys.exit(1) | ||
|
||
tag_name = os.environ[TAG_ENV] | ||
match = TAG_RE.match(tag_name) | ||
if match is None: | ||
print(BAD_TAG_MSG % (tag_name,), file=sys.stderr) | ||
sys.exit(1) | ||
|
||
pkg_name = match.group('pkg') | ||
if pkg_name is None: | ||
print(ROOT_DIR) | ||
else: | ||
pkg_dir = pkg_name.rstrip('-').replace('-', '_') | ||
print(os.path.join(ROOT_DIR, pkg_dir)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2016 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -ev | ||
|
||
# If this is not a CircleCI tag, no-op. | ||
if [[ -z "$CIRCLE_TAG" ]]; then | ||
echo "This is not a release tag. Doing nothing." | ||
exit 0 | ||
fi | ||
|
||
# H/T: http://stackoverflow.com/a/246128/1068170 | ||
SCRIPT="$(dirname "${BASH_SOURCE[0]}")/get_tagged_package.py" | ||
# Determine the package directory being deploying on this tag. | ||
PKG_DIR="$(python ${SCRIPT})" | ||
|
||
# Ensure that we have the latest versions of Twine, Wheel, and Setuptools. | ||
python3 -m pip install --upgrade twine wheel setuptools | ||
|
||
# Move into the package, build the distribution and upload. | ||
cd ${PKG_DIR} | ||
python3 setup.py sdist bdist_wheel | ||
twine upload dist/* |
Uh oh!
There was an error while loading. Please reload this page.