@@ -61,15 +61,15 @@ def list_files(folder, pattern):
6161 yield os .path .join (root , filename )
6262
6363
64- def collect_sample_dirs (start_dir , blacklist = set ()):
64+ def collect_sample_dirs (start_dir , blacklist = set (), suffix = '_test.py' ):
6565 """Recursively collects a list of dirs that contain tests.
6666
6767 This works by listing the contents of directories and finding
6868 directories that have `*_test.py` files.
6969 """
7070 # Collect all the directories that have tests in them.
7171 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 ) ):
7373 # Don't recurse further, since py.test will do that.
7474 del subdirs [:]
7575 # This dir has tests in it. yield it.
@@ -240,9 +240,9 @@ def session_lint(session):
240240 """Lints each sample."""
241241 sample_directories = session .posargs
242242 if not sample_directories :
243- sample_directories = collect_sample_dirs ('.' )
243+ sample_directories = collect_sample_dirs ('.' , suffix = '.py' )
244244
245- # On travis, on lint changed samples.
245+ # On travis, only lint changed samples.
246246 if ON_TRAVIS :
247247 changed_files = get_changed_files ()
248248 sample_directories = filter_samples (
0 commit comments