@@ -61,15 +61,15 @@ def list_files(folder, pattern):
61
61
yield os .path .join (root , filename )
62
62
63
63
64
- def collect_sample_dirs (start_dir , blacklist = set ()):
64
+ def collect_sample_dirs (start_dir , blacklist = set (), suffix = '_test.py' ):
65
65
"""Recursively collects a list of dirs that contain tests.
66
66
67
67
This works by listing the contents of directories and finding
68
68
directories that have `*_test.py` files.
69
69
"""
70
70
# Collect all the directories that have tests in them.
71
71
for parent , subdirs , files in os .walk (start_dir ):
72
- if any (f for f in files if f [ - 8 :] == '_test.py' ):
72
+ if any (f for f in files if f . endswith ( suffix ) ):
73
73
# Don't recurse further, since py.test will do that.
74
74
del subdirs [:]
75
75
# This dir has tests in it. yield it.
@@ -240,9 +240,9 @@ def session_lint(session):
240
240
"""Lints each sample."""
241
241
sample_directories = session .posargs
242
242
if not sample_directories :
243
- sample_directories = collect_sample_dirs ('.' )
243
+ sample_directories = collect_sample_dirs ('.' , suffix = '.py' )
244
244
245
- # On travis, on lint changed samples.
245
+ # On travis, only lint changed samples.
246
246
if ON_TRAVIS :
247
247
changed_files = get_changed_files ()
248
248
sample_directories = filter_samples (
0 commit comments