13
13
# limitations under the License.
14
14
15
15
import fnmatch
16
+ import itertools
16
17
import os
17
18
import subprocess
18
19
import tempfile
@@ -103,30 +104,26 @@ def setup_appengine(session):
103
104
104
105
def run_tests_in_sesssion (
105
106
session , interpreter , use_appengine = False , skip_flaky = False ,
106
- changed_only = False ):
107
+ changed_only = False , sample_directories = None ):
107
108
session .interpreter = interpreter
108
109
session .install (REPO_TOOLS_REQ )
109
110
session .install ('-r' , 'requirements-{}-dev.txt' .format (interpreter ))
110
111
111
112
if use_appengine :
112
113
setup_appengine (session )
113
- sample_root = 'appengine/standard'
114
- else :
115
- sample_root = '.'
116
114
117
115
pytest_args = COMMON_PYTEST_ARGS [:]
118
116
119
117
if skip_flaky :
120
118
pytest_args .append ('-m not slow and not flaky' )
121
119
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 )
130
127
131
128
if changed_only :
132
129
changed_files = get_changed_files ()
@@ -154,7 +151,19 @@ def session_tests(session, interpreter):
154
151
155
152
def session_gae (session ):
156
153
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' )))
158
167
159
168
160
169
@nox .parametrize ('subsession' , ['gae' , 'tests' ])
@@ -166,7 +175,10 @@ def session_travis(session, subsession):
166
175
else :
167
176
run_tests_in_sesssion (
168
177
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 ))
170
182
171
183
172
184
def session_lint (session ):
0 commit comments