From 58ae3b745ab15bccfce3d143575496cb4addc282 Mon Sep 17 00:00:00 2001 From: Brian McCutchon Date: Fri, 14 Sep 2018 12:25:34 -0700 Subject: [PATCH] Add "offline" positional argument to system tests This is a temporary measure for offline testing of certain libraries. --- bigquery/nox.py | 33 +++++++++++++++++---------------- bigtable/nox.py | 22 +++++++++++----------- dataproc/nox.py | 9 +++++---- logging/nox.py | 35 ++++++++++++++++++----------------- pubsub/nox.py | 19 ++++++++++--------- storage/nox.py | 31 ++++++++++++++++--------------- 6 files changed, 77 insertions(+), 72 deletions(-) diff --git a/bigquery/nox.py b/bigquery/nox.py index a9d9242c55ac..da90550a31cb 100644 --- a/bigquery/nox.py +++ b/bigquery/nox.py @@ -96,22 +96,23 @@ def system(session, py): # Set the virtualenv dirname. session.virtualenv_dirname = 'sys-' + py - # Use pre-release gRPC for system tests. - session.install('--pre', 'grpcio') - - # Install all test dependencies, then install local packages in place. - session.install('mock', 'pytest') - for local_dep in LOCAL_DEPS: - session.install('-e', local_dep) - session.install('-e', os.path.join('..', 'storage')) - session.install('-e', os.path.join('..', 'test_utils')) - session.install('-e', '.[pandas]') - - # IPython does not support Python 2 after version 5.x - if session.interpreter == 'python2.7': - session.install('ipython==5.5') - else: - session.install('ipython') + if 'offline' not in session.posargs: + # Use pre-release gRPC for system tests. + session.install('--pre', 'grpcio') + + # Install all test dependencies, then install local packages in place. + session.install('mock', 'pytest') + for local_dep in LOCAL_DEPS: + session.install('-e', local_dep) + session.install('-e', os.path.join('..', 'storage')) + session.install('-e', os.path.join('..', 'test_utils')) + session.install('-e', '.[pandas]') + + # IPython does not support Python 2 after version 5.x + if session.interpreter == 'python2.7': + session.install('ipython==5.5') + else: + session.install('ipython') # Run py.test against the system tests. session.run( diff --git a/bigtable/nox.py b/bigtable/nox.py index e8c0ac93df88..8ee5036c1e35 100644 --- a/bigtable/nox.py +++ b/bigtable/nox.py @@ -67,7 +67,6 @@ def unit(session, py): default(session) - @nox.session @nox.parametrize('py', ['2.7', '3.6']) def system(session, py): @@ -83,16 +82,17 @@ def system(session, py): # Set the virtualenv dirname. session.virtualenv_dirname = 'sys-' + py - # 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') - for local_dep in LOCAL_DEPS: - session.install('-e', local_dep) - session.install('-e', '../test_utils/') - session.install('-e', '.') + if 'offline' not in session.posargs: + # 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') + for local_dep in LOCAL_DEPS: + session.install('-e', local_dep) + session.install('-e', '../test_utils/') + session.install('-e', '.') # Run py.test against the system tests. session.run('py.test', '--quiet', 'tests/system.py', *session.posargs) diff --git a/dataproc/nox.py b/dataproc/nox.py index 3d84096895e3..c8de742ecbed 100644 --- a/dataproc/nox.py +++ b/dataproc/nox.py @@ -74,11 +74,12 @@ def system(session, py): session.virtualenv_dirname = 'sys-' + py - # Use pre-release gRPC for system tests. - session.install('--pre', 'grpcio') + if 'offline' not in session.posargs: + # Use pre-release gRPC for system tests. + session.install('--pre', 'grpcio') - session.install('pytest') - session.install('-e', '.') + session.install('pytest') + session.install('-e', '.') session.run('py.test', '--quiet', os.path.join('tests', 'system'), *session.posargs) diff --git a/logging/nox.py b/logging/nox.py index 3ac0c3c9e217..e039b0c533c9 100644 --- a/logging/nox.py +++ b/logging/nox.py @@ -110,23 +110,24 @@ def system(session, py): # Set the virtualenv dirname. session.virtualenv_dirname = 'sys-' + py - # 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') - for local_dep in LOCAL_DEPS: - session.install('-e', local_dep) - systest_deps = [ - '../bigquery/', - '../pubsub/', - '../storage/', - '../test_utils/', - ] - for systest_dep in systest_deps: - session.install('-e', systest_dep) - session.install('-e', '.') + if 'offline' not in session.posargs: + # 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') + for local_dep in LOCAL_DEPS: + session.install('-e', local_dep) + systest_deps = [ + '../bigquery/', + '../pubsub/', + '../storage/', + '../test_utils/', + ] + for systest_dep in systest_deps: + session.install('-e', systest_dep) + session.install('-e', '.') # Run py.test against the system tests. session.run( diff --git a/pubsub/nox.py b/pubsub/nox.py index fc887cadfdc8..a5b730151e3b 100644 --- a/pubsub/nox.py +++ b/pubsub/nox.py @@ -83,15 +83,16 @@ def system(session, py): # Set the virtualenv dirname. session.virtualenv_dirname = 'sys-' + py - # Use pre-release gRPC for system tests. - session.install('--pre', 'grpcio') - - # Install all test dependencies, then install local packages in-place. - session.install('mock', 'pytest') - for local_dep in LOCAL_DEPS: - session.install('-e', local_dep) - session.install('-e', '../test_utils/') - session.install('-e', '.') + if 'offline' not in session.posargs: + # Use pre-release gRPC for system tests. + session.install('--pre', 'grpcio') + + # Install all test dependencies, then install local packages in-place. + session.install('mock', 'pytest') + for local_dep in LOCAL_DEPS: + session.install('-e', local_dep) + session.install('-e', '../test_utils/') + session.install('-e', '.') # Run py.test against the system tests. session.run( diff --git a/storage/nox.py b/storage/nox.py index de8737970e80..b28dbe1bd837 100644 --- a/storage/nox.py +++ b/storage/nox.py @@ -84,21 +84,22 @@ def system(session, py): # Set the virtualenv dirname. session.virtualenv_dirname = 'sys-' + py - # Use pre-release gRPC for system tests. - session.install('--pre', 'grpcio') - - # Install all test dependencies, then install local packages in-place. - session.install('mock', 'pytest') - for local_dep in LOCAL_DEPS: - session.install('-e', local_dep) - systest_deps = [ - '../test_utils/', - '../pubsub', - '../kms', - ] - for systest_dep in systest_deps: - session.install('-e', systest_dep) - session.install('-e', '.') + if 'offline' not in session.posargs: + # Use pre-release gRPC for system tests. + session.install('--pre', 'grpcio') + + # Install all test dependencies, then install local packages in-place. + session.install('mock', 'pytest') + for local_dep in LOCAL_DEPS: + session.install('-e', local_dep) + systest_deps = [ + '../test_utils/', + '../pubsub', + '../kms', + ] + for systest_dep in systest_deps: + session.install('-e', systest_dep) + session.install('-e', '.') # Run py.test against the system tests. session.run('py.test', '--quiet', 'tests/system.py', *session.posargs)