Skip to content
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

Added flag to temporarily disable pylint #50

Merged
merged 1 commit into from
Jul 2, 2018
Merged
Show file tree
Hide file tree
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: 7 additions & 1 deletion pytest_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def pytest_addoption(parser):
action="store_true", default=False,
help="run pylint on all"
)
group.addoption(
"--no-pylint",
action="store_true", default=False,
help="disable running pylint "
)

group.addoption(
'--pylint-rcfile',
default=None,
Expand Down Expand Up @@ -121,7 +127,7 @@ def pytest_sessionstart(session):
def pytest_collect_file(path, parent):
"""Collect files on which pylint should run"""
config = parent.config
if not config.option.pylint:
if not config.option.pylint or config.option.no_pylint:
return None
if path.ext != ".py":
return None
Expand Down
9 changes: 9 additions & 0 deletions test_pytest_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ def test_basic(testdir):
assert 'Unused import sys' in result.stdout.str()
assert 'Final newline missing' in result.stdout.str()
assert 'passed' not in result.stdout.str()
assert 'Linting files' in result.stdout.str()


def test_disable(testdir):
"""Verify basic pylint checks"""
testdir.makepyfile("""import sys""")
result = testdir.runpytest('--pylint --no-pylint')
assert 'Final newline missing' not in result.stdout.str()
assert 'Linting files' not in result.stdout.str()


def test_error_control(testdir):
Expand Down