summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-02-02 10:05:06 -0800
committerDylan Baker <dylan@pnwbakers.com>2017-02-08 09:44:07 -0800
commitcbd7a095c0e8ab80a6b7cca1ae71641e74e8e2bc (patch)
treee31276e0b806a8329c740b369f30f87d50a6d6fc
parenta5da860c9e03a545a39f9e719a3f7e743cdac777 (diff)
tests: Instruct pylint to ignore a large swath of warnings
There are a number of things pylint warns on that absolutely make sense to fix in production code, but for unittests they either don't matter (like naming variables "foo"), can't be fixed (TestCase methods that don't use self because they use a mock assert), or the descriptive names violate PEP8. These are annoying and create noise, so tell pylint to ignore them.
-rw-r--r--tests/commands/envelope_tests.py5
-rw-r--r--tests/commands/init_test.py9
-rw-r--r--tests/commands/thread_test.py7
-rw-r--r--tests/completion_test.py4
-rw-r--r--tests/utils/argparse_test.py10
-rw-r--r--tests/utils/configobj_test.py4
-rw-r--r--tests/widgets/globals_test.py2
7 files changed, 39 insertions, 2 deletions
diff --git a/tests/commands/envelope_tests.py b/tests/commands/envelope_tests.py
index 6d68d4d3..cd6684a8 100644
--- a/tests/commands/envelope_tests.py
+++ b/tests/commands/envelope_tests.py
@@ -27,9 +27,14 @@ import mock
from alot.commands import envelope
+# When using an assert from a mock a TestCase method might not use self. That's
+# okay.
+# pylint: disable=no-self-use
+
@contextlib.contextmanager
def temporary_directory(suffix='', prefix='', dir=None):
+ # pylint: disable=redefined-builtin
"""Python3 interface implementation.
Python3 provides a class that can be used as a context manager, which
diff --git a/tests/commands/init_test.py b/tests/commands/init_test.py
index 5caf7eb0..15eb06df 100644
--- a/tests/commands/init_test.py
+++ b/tests/commands/init_test.py
@@ -12,6 +12,13 @@ import mock
from alot import commands
from alot.commands import thread
+# Good descriptive test names often don't fit PEP8, which is meant to cover
+# functions meant to be called by humans.
+# pylint: disable=invalid-name
+
+# These are tests, don't worry about names like "foo" and "bar"
+# pylint: disable=blacklisted-name
+
class TestLookupCommand(unittest.TestCase):
@@ -39,7 +46,7 @@ class TestRegisterCommand(unittest.TestCase):
"""using registerCommand adds to the COMMANDS dict."""
with mock.patch('alot.commands.COMMANDS', {'foo': {}}):
@commands.registerCommand('foo', 'test')
- def foo():
+ def foo(): # pylint: disable=unused-variable
pass
self.assertIn('test', commands.COMMANDS['foo'])
diff --git a/tests/commands/thread_test.py b/tests/commands/thread_test.py
index bb8514d6..704039c1 100644
--- a/tests/commands/thread_test.py
+++ b/tests/commands/thread_test.py
@@ -10,6 +10,13 @@ import unittest
from alot.commands import thread
+# Good descriptive test names often don't fit PEP8, which is meant to cover
+# functions meant to be called by humans.
+# pylint: disable=invalid-name
+
+# These are tests, don't worry about names like "foo" and "bar"
+# pylint: disable=blacklisted-name
+
class Test_ensure_unique_address(unittest.TestCase):
diff --git a/tests/completion_test.py b/tests/completion_test.py
index 28bf410e..855df03f 100644
--- a/tests/completion_test.py
+++ b/tests/completion_test.py
@@ -12,6 +12,10 @@ import mock
from alot import completion
+# Good descriptive test names often don't fit PEP8, which is meant to cover
+# functions meant to be called by humans.
+# pylint: disable=invalid-name
+
def _mock_lookup(query):
"""Look up the query from fixed list of names and email addresses."""
diff --git a/tests/utils/argparse_test.py b/tests/utils/argparse_test.py
index b208da8c..91f8a3f4 100644
--- a/tests/utils/argparse_test.py
+++ b/tests/utils/argparse_test.py
@@ -29,6 +29,14 @@ import mock
from alot.utils import argparse as cargparse
+# Good descriptive test names often don't fit PEP8, which is meant to cover
+# functions meant to be called by humans.
+# pylint: disable=invalid-name
+
+# When using mock asserts its possible that many methods will not use self,
+# that's fine
+# pylint: disable=no-self-use
+
class TestValidatedStore(unittest.TestCase):
"""Tests for the ValidatedStore action class."""
@@ -56,7 +64,7 @@ class TestValidatedStore(unittest.TestCase):
@contextlib.contextmanager
-def temporary_directory(suffix='', prefix='', dir=None):
+def temporary_directory(suffix='', prefix='', dir=None): # pylint: disable=redefined-builtin
"""Python3 interface implementation.
Python3 provides a class that can be used as a context manager, which
diff --git a/tests/utils/configobj_test.py b/tests/utils/configobj_test.py
index 9b212f29..65747328 100644
--- a/tests/utils/configobj_test.py
+++ b/tests/utils/configobj_test.py
@@ -5,6 +5,10 @@ import unittest
from alot.utils import configobj as checks
+# Good descriptive test names often don't fit PEP8, which is meant to cover
+# functions meant to be called by humans.
+# pylint: disable=invalid-name
+
class TestForceList(unittest.TestCase):
diff --git a/tests/widgets/globals_test.py b/tests/widgets/globals_test.py
index 7d7d6547..52563b84 100644
--- a/tests/widgets/globals_test.py
+++ b/tests/widgets/globals_test.py
@@ -29,6 +29,8 @@ class TestTagWidget(unittest.TestCase):
def test_sort(self):
"""Test sorting."""
+ # There's an upstream bug about this
+ # pylint: disable=bad-continuation
with mock.patch(
'alot.widgets.globals.settings.get_tagstring_representation',
lambda t, _, __: {'translated': t, 'normal': None,