1313# limitations under the License.
1414
1515import fnmatch
16+ import itertools
1617import os
1718import subprocess
1819import tempfile
@@ -103,30 +104,26 @@ def setup_appengine(session):
103104
104105def 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
155152def 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
172184def session_lint (session ):
0 commit comments