Skip to content

Lint session should check all changed files. #619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions nox.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ def list_files(folder, pattern):
yield os.path.join(root, filename)


def collect_sample_dirs(start_dir, blacklist=set()):
def collect_sample_dirs(start_dir, blacklist=set(), suffix='_test.py'):
"""Recursively collects a list of dirs that contain tests.

This works by listing the contents of directories and finding
directories that have `*_test.py` files.
"""
# Collect all the directories that have tests in them.
for parent, subdirs, files in os.walk(start_dir):
if any(f for f in files if f[-8:] == '_test.py'):
if any(f for f in files if f.endswith(suffix)):
# Don't recurse further, since py.test will do that.
del subdirs[:]
# This dir has tests in it. yield it.
Expand Down Expand Up @@ -240,9 +240,9 @@ def session_lint(session):
"""Lints each sample."""
sample_directories = session.posargs
if not sample_directories:
sample_directories = collect_sample_dirs('.')
sample_directories = collect_sample_dirs('.', suffix='.py')

# On travis, on lint changed samples.
# On travis, only lint changed samples.
if ON_TRAVIS:
changed_files = get_changed_files()
sample_directories = filter_samples(
Expand Down