30
30
"""
31
31
32
32
import fnmatch
33
- import itertools
34
33
import os
35
34
import subprocess
36
35
import tempfile
46
45
'-x' , '--no-success-flaky-report' , '--cov' , '--cov-config' ,
47
46
'.coveragerc' , '--cov-append' , '--cov-report=' ]
48
47
49
- # Blacklists of samples to ingnore.
50
- # Bigtable and Speech are disabled because they use gRPC, which does not yet
51
- # support Python 3. See: https://github.com/grpc/grpc/issues/282
52
- TESTS_BLACKLIST = set ((
53
- './appengine/standard' ,
54
- './bigtable' ,
55
- './speech' ,
56
- './testing' ))
57
- APPENGINE_BLACKLIST = set ()
58
-
59
48
60
49
# Libraries that only work on Python 2.7
61
50
PY27_ONLY_LIBRARIES = ['mysql-python' ]
@@ -143,8 +132,8 @@ def setup_appengine(session):
143
132
144
133
145
134
def run_tests_in_sesssion (
146
- session , interpreter , use_appengine = False , skip_flaky = False ,
147
- changed_only = False , sample_directories = None ):
135
+ session , interpreter , sample_directories , use_appengine = False ,
136
+ skip_flaky = False , changed_only = False ):
148
137
"""This is the main function for executing tests.
149
138
150
139
It:
@@ -173,13 +162,6 @@ def run_tests_in_sesssion(
173
162
if skip_flaky :
174
163
pytest_args .append ('-m not slow and not flaky' )
175
164
176
- # session.posargs is any leftover arguments from the command line,
177
- # which allows users to run a particular test instead of all of them.
178
- if session .posargs :
179
- sample_directories = session .posargs
180
- elif sample_directories is None :
181
- sample_directories = collect_sample_dirs ('.' , TESTS_BLACKLIST )
182
-
183
165
if changed_only :
184
166
changed_files = get_changed_files ()
185
167
sample_directories = filter_samples (
@@ -204,43 +186,39 @@ def run_tests_in_sesssion(
204
186
205
187
@nox .parametrize ('interpreter' , ['python2.7' , 'python3.4' ])
206
188
def session_tests (session , interpreter ):
207
- """Runs tests"""
208
- run_tests_in_sesssion (session , interpreter )
189
+ """Runs tests for all non-gae standard samples."""
190
+ # session.posargs is any leftover arguments from the command line,
191
+ # which allows users to run a particular test instead of all of them.
192
+ if session .posargs :
193
+ sample_directories = session .posargs
194
+ elif sample_directories is None :
195
+ sample_directories = collect_sample_dirs (
196
+ '.' , set ('./appengine/standard' ))
197
+
198
+ run_tests_in_sesssion (session , interpreter , sample_directories )
209
199
210
200
211
201
def session_gae (session ):
212
202
"""Runs test for GAE Standard samples."""
203
+ sample_directories = collect_sample_dirs ('appengine/standard' )
213
204
run_tests_in_sesssion (
214
- session , 'python2.7' , use_appengine = True ,
215
- sample_directories = collect_sample_dirs (
216
- 'appengine/standard' ,
217
- APPENGINE_BLACKLIST ))
218
-
219
-
220
- def session_grpc (session ):
221
- """Runs tests for samples that need grpc."""
222
- # TODO: Remove this when grpc supports Python 3.
223
- run_tests_in_sesssion (
224
- session ,
225
- 'python2.7' ,
226
- sample_directories = itertools .chain (
227
- collect_sample_dirs ('speech' ),
228
- collect_sample_dirs ('bigtable' )))
205
+ session , 'python2.7' , sample_directories , use_appengine = True )
229
206
230
207
231
208
@nox .parametrize ('subsession' , ['gae' , 'tests' ])
232
209
def session_travis (session , subsession ):
233
210
"""On travis, just run with python3.4 and don't run slow or flaky tests."""
234
211
if subsession == 'tests' :
212
+ sample_directories = collect_sample_dirs (
213
+ '.' , set ('./appengine/standard' ))
235
214
run_tests_in_sesssion (
236
- session , 'python3.4' , skip_flaky = True , changed_only = True )
215
+ session , 'python3.4' , sample_directories , skip_flaky = True ,
216
+ changed_only = True )
237
217
else :
218
+ sample_directories = collect_sample_dirs ('appengine/standard' )
238
219
run_tests_in_sesssion (
239
- session , 'python2.7' , use_appengine = True , skip_flaky = True ,
240
- changed_only = True ,
241
- sample_directories = collect_sample_dirs (
242
- 'appengine/standard' ,
243
- APPENGINE_BLACKLIST ))
220
+ session , 'python2.7' , sample_directories , use_appengine = True ,
221
+ skip_flaky = True , changed_only = True )
244
222
245
223
246
224
def session_lint (session ):
0 commit comments