@@ -40,8 +40,9 @@ def _list_files(folder, pattern):
40
40
41
41
def _collect_dirs (
42
42
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 ):
45
46
"""Recursively collects a list of dirs that contain a file matching the
46
47
given suffix.
47
48
@@ -50,17 +51,20 @@ def _collect_dirs(
50
51
"""
51
52
# Collect all the directories that have tests in them.
52
53
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.
57
61
yield parent
58
62
else :
59
63
# Filter out dirs we don't want to recurse into
60
64
subdirs [:] = [
61
65
s for s in subdirs
62
66
if s [0 ].isalpha () and
63
- os . path . join ( parent , s ) not in blacklist ]
67
+ s not in blacklist ]
64
68
65
69
66
70
def _get_changed_files ():
@@ -149,7 +153,7 @@ def _setup_appengine_sdk(session):
149
153
150
154
# Collect sample directories.
151
155
ALL_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 )))
153
157
GAE_STANDARD_SAMPLES = [
154
158
sample for sample in ALL_TESTED_SAMPLES
155
159
if sample .startswith ('./appengine/standard/' )]
0 commit comments