@@ -40,8 +40,9 @@ def _list_files(folder, pattern):
4040
4141def _collect_dirs (
4242 start_dir ,
43- blacklist = set (['conftest.py' , 'nox.py' ]),
44- suffix = '_test.py' ):
43+ blacklist = set (['conftest.py' , 'nox.py' , 'lib' ]),
44+ suffix = '_test.py' ,
45+ recurse_further = False ):
4546 """Recursively collects a list of dirs that contain a file matching the
4647 given suffix.
4748
@@ -50,17 +51,20 @@ def _collect_dirs(
5051 """
5152 # Collect all the directories that have tests in them.
5253 for parent , subdirs , files in os .walk (start_dir ):
53- if any (f for f in files if f .endswith (suffix ) and f not in blacklist ):
54- # Don't recurse further, since py.test will do that.
55- del subdirs [:]
56- # This dir has tests in it. yield it.
54+ if './.' in parent :
55+ continue # Skip top-level dotfiles
56+ elif any (f for f in files if f .endswith (suffix ) and f not in blacklist ):
57+ # Don't recurse further for tests, since py.test will do that.
58+ if not recurse_further :
59+ del subdirs [:]
60+ # This dir has desired files in it. yield it.
5761 yield parent
5862 else :
5963 # Filter out dirs we don't want to recurse into
6064 subdirs [:] = [
6165 s for s in subdirs
6266 if s [0 ].isalpha () and
63- os . path . join ( parent , s ) not in blacklist ]
67+ s not in blacklist ]
6468
6569
6670def _get_changed_files ():
@@ -149,7 +153,7 @@ def _setup_appengine_sdk(session):
149153
150154# Collect sample directories.
151155ALL_TESTED_SAMPLES = sorted (list (_collect_dirs ('.' )))
152- ALL_SAMPLE_DIRECTORIES = sorted (list (_collect_dirs ('.' , suffix = '.py' )))
156+ ALL_SAMPLE_DIRECTORIES = sorted (list (_collect_dirs ('.' , suffix = '.py' , recurse_further = True )))
153157GAE_STANDARD_SAMPLES = [
154158 sample for sample in ALL_TESTED_SAMPLES
155159 if sample .startswith ('./appengine/standard/' )]
0 commit comments