Enable lint checks without big code changes

This change enables loads of pylint checks that do not require big code
changes.
Signed-off-by: NCaio Carrara <ccarrara@redhat.com>
上级 e9768393
......@@ -391,26 +391,30 @@ class TestAvocadoParams(unittest.TestCase):
'ooo')
def test_get_clashes(self):
# py2 and py3 compatibility. assertRaisesRegex only exists in py3
if not hasattr(self, 'assertRaisesRegex'):
self.assertRaisesRegex = self.assertRaisesRegexp
# One inherited, the other is new
self.assertRaisesRegexp(ValueError, r"'clash1'.* \['/ch0/ch0.1/ch0.1.1"
r"/ch0.1.1.1=>equal', '/ch0=>equal'\]",
self.params1.get, 'clash1',
default='nnn')
self.assertRaisesRegex(ValueError, r"'clash1'.* \['/ch0/ch0.1/ch0.1.1"
r"/ch0.1.1.1=>equal', '/ch0=>equal'\]",
self.params1.get, 'clash1',
default='nnn')
# Only inherited ones
self.assertEqual(self.params2.get('clash1', default='ooo'),
'equal')
# Booth of different origin
self.assertRaisesRegexp(ValueError,
r"'clash2'.* \['/ch11=>equal', "
r"'/ch111=>equal'\]", self.params1.get,
'clash2', path='/*')
self.assertRaisesRegex(ValueError,
r"'clash2'.* \['/ch11=>equal', "
r"'/ch111=>equal'\]", self.params1.get,
'clash2', path='/*')
# Filter-out the clash
self.assertEqual(self.params1.get('clash2', path='/ch11/*'), 'equal')
# simple clash in params1
self.assertRaisesRegexp(ValueError, r"'clash3'.* \['/ch0=>also equal',"
r" '/ch0/ch0.1b/ch0.1.2=>also equal'\]",
self.params1.get, 'clash3',
default='nnn')
self.assertRaisesRegex(ValueError, r"'clash3'.* \['/ch0=>also equal',"
r" '/ch0/ch0.1b/ch0.1.2=>also equal'\]",
self.params1.get, 'clash3',
default='nnn')
# params2 is sliced the other way around so it returns before the clash
self.assertEqual(self.params2.get('clash3', default='nnn'),
'also equal')
......
......@@ -169,7 +169,7 @@ results_dir_content() {
[ "$SKIP_RESULTSDIR_CHECK" ] || RESULTS_DIR_CONTENT="$(ls $RESULTS_DIR 2> /dev/null)"
LINT_CMD="inspekt lint --exclude=.git"
PYLINT_ENABLE="--enable R0401,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0110,W0111,W0120,W0122,W0123,W0124,W0125,W0150,W0404,W0611,W0612,W0622,W1645"
PYLINT_ENABLE="--enable R0401,W0101,W0102,W0104,W0105,W0106,W0107,W0108,W0109,W0111,W0120,W0122,W0123,W0124,W0125,W0150,W0199,W0211,W0222,W0232,W0233,W0301,W0312,W0401,W0404,W0406,W0410,W0601,W0602,W0604,W0611,W0612,W0614,W0622,W0623,W0640,W0711,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1645"
if [ "$AVOCADO_PARALLEL_LINT" ]; then
LINT_CMD="$LINT_CMD --parallel=$AVOCADO_PARALLEL_LINT"
fi
......
......@@ -59,13 +59,13 @@ class AstringTest(unittest.TestCase):
123),
(u'\u0430\u0432\u043e\u043a\u0430\u0434\xff', 123),
("avok\xc3\xa1do", 123),
("a\u0430", 123)]
("a\u0430", 123)] # pylint: disable=W1402
str_matrix = ("\xd0\xb0\xd0\xb2\xd0\xbe\xd0\xba\xd0\xb0\xd0\xb4"
"\xef\xbf\xbd 123\n"
"\xd0\xb0\xd0\xb2\xd0\xbe\xd0\xba\xd0\xb0\xd0\xb4"
"\xc3\xbf 123\n"
"avok\xc3\xa1do 123\n"
"a\u0430 123")
"a\u0430 123") # pylint: disable=W1402
self.assertEqual(astring.tabular_output(matrix), str_matrix)
def test_safe_path(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册