8000 Add session for gRPC samples. (#385) · kler/python-docs-samples@3fd9905 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 3fd9905

Browse files
tswastJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Add session for gRPC samples. (GoogleCloudPlatform#385)
These samples are being excluded from the plain `tests` target, since they require the gRPC libraries (which are not compatible with Python 3, yet). This means they are not running on Jenkins or Travis. By adding another session, we will be able to run the tests for these samples on Jenkins.
1 parent 2e3ab14 commit 3fd9905

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

nox.py

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
import fnmatch
16+
import itertools
1617
import os
1718
import subprocess
1819
import tempfile
@@ -103,30 +104,26 @@ def setup_appengine(session):
103104

104105
def run_tests_in_sesssion(
105106
session, interpreter, use_appengine=False, skip_flaky=False,
106-
changed_only=False):
107+
changed_only=False, sample_directories=None):
107108
session.interpreter = interpreter
108109
session.install(REPO_TOOLS_REQ)
109110
session.install('-r', 'requirements-{}-dev.txt'.format(interpreter))
110111

111112
if use_appengine:
112113
setup_appengine(session)
113-
sample_root = 'appengine/standard'
114-
else:
115-
sample_root = '.'
116114

117115
pytest_args = COMMON_PYTEST_ARGS[:]
118116

119117
if skip_flaky:
120118
pytest_args.append('-m not slow and not flaky')
121119

122-
# session.posargs is any leftover arguments from the command line, which
123-
# allows users to run a particular test instead of all of them.
124-
if session.posargs:
125-
sample_directories = session.posargs
126-
else:
127-
sample_directories = collect_sample_dirs(
128-
sample_root,
129-
TESTS_BLACKLIST if not use_appengine else APPENGINE_BLACKLIST)
120+
if sample_directories is None:
121+
# session.posargs is any leftover arguments from the command line,
122+
# which allows users to run a particular test instead of all of them.
123+
if session.posargs:
124+
sample_directories = session.posargs
125+
else:
126+
sample_directories = collect_sample_dirs('.', TESTS_BLACKLIST)
130127

131128
if changed_only:
132129
changed_files = get_changed_files()
@@ -154,7 +151,19 @@ def session_tests(session, interpreter):
154151

155152
def session_gae(session):
156153
run_tests_in_sesssion(
157-
session, 'python2.7', use_appengine=True)
154+
session, 'python2.7', use_appengine=True,
155+
sample_directories=collect_sample_dirs(
156+
'appengine/standard',
157+
APPENGINE_BLACKLIST))
158+
159+
160+
def session_grpc(session):
161+
run_tests_in_sesssion(
162+
session,
163+
'python2.7',
164+
sample_directories=itertools.chain(
165+
collect_sample_dirs('speech'),
166+
collect_sample_dirs('bigtable')))
158167

159168

160169
@nox.parametrize('subsession', ['gae', 'tests'])
@@ -166,7 +175,10 @@ def session_travis(session, subsession):
166175
else:
167176
run_tests_in_sesssion(
168177
session, 'python2.7', use_appengine=True, skip_flaky=True,
169-
changed_only=True)
178+
changed_only=True,
179+
sample_directories=collect_sample_dirs(
180+
'appengine/standard',
181+
APPENGINE_BLACKLIST))
170182

171183

172184
def session_lint(session):

0 commit comments

Comments
 (0)
0