3030"""
3131
3232import fnmatch
33- import itertools
3433import os
3534import subprocess
3635import tempfile
4645 '-x' , '--no-success-flaky-report' , '--cov' , '--cov-config' ,
4746 '.coveragerc' , '--cov-append' , '--cov-report=' ]
4847
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-
5948
6049# Libraries that only work on Python 2.7
6150PY27_ONLY_LIBRARIES = ['mysql-python' ]
@@ -143,8 +132,8 @@ def setup_appengine(session):
143132
144133
145134def 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 ):
148137 """This is the main function for executing tests.
149138
150139 It:
@@ -173,13 +162,6 @@ def run_tests_in_sesssion(
173162 if skip_flaky :
174163 pytest_args .append ('-m not slow and not flaky' )
175164
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-
183165 if changed_only :
184166 changed_files = get_changed_files ()
185167 sample_directories = filter_samples (
@@ -204,43 +186,39 @@ def run_tests_in_sesssion(
204186
205187@nox .parametrize ('interpreter' , ['python2.7' , 'python3.4' ])
206188def 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 )
209199
210200
211201def session_gae (session ):
212202 """Runs test for GAE Standard samples."""
203+ sample_directories = collect_sample_dirs ('appengine/standard' )
213204 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 )
229206
230207
231208@nox .parametrize ('subsession' , ['gae' , 'tests' ])
232209def session_travis (session , subsession ):
233210 """On travis, just run with python3.4 and don't run slow or flaky tests."""
234211 if subsession == 'tests' :
212+ sample_directories = collect_sample_dirs (
213+ '.' , set ('./appengine/standard' ))
235214 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 )
237217 else :
218+ sample_directories = collect_sample_dirs ('appengine/standard' )
238219 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 )
244222
245223
246224def session_lint (session ):
0 commit comments