未验证 提交 924ad27a 编写于 作者: C Cleber Rosa

Merge branch 'enable-pylint-w0613'

Signed-off-by: NCleber Rosa <crosa@redhat.com>
......@@ -62,7 +62,7 @@ def skip(message=None):
def decorator(function):
if not isinstance(function, type):
@wraps(function)
def wrapper(*args, **kwargs):
def wrapper(*args, **kwargs): # pylint: disable=W0613
raise core_exceptions.TestSkipError(message)
function = wrapper
function.__skip_test_decorator__ = True
......
......@@ -609,7 +609,7 @@ class FileLoader(TestLoader):
tests.extend(self._make_tests(exception.filename,
which_tests == DiscoverMode.ALL))
def skip_non_test(exception):
def skip_non_test(exception): # pylint: disable=W0613
""" Always return None """
return None
......@@ -743,7 +743,7 @@ class FileLoader(TestLoader):
:param list_non_tests: include bad tests (NotATest, BrokenSymlink,...)
:param subtests_filter: optional filter of methods for avocado tests
"""
def ignore_broken(klass, uid, description=None):
def ignore_broken(klass, uid, description=None): # pylint: disable=W0613
""" Always return empty list """
return []
......
......@@ -137,7 +137,7 @@ class FakeVariantDispatcher(object):
else:
return []
def to_str(self, summary=0, variants=0, **kwargs):
def to_str(self, summary=0, variants=0, **kwargs): # pylint: disable=W0613
if not self.variants:
return ""
out = []
......
......@@ -44,7 +44,7 @@ class JournalResult(ResultEvents):
name = 'journal'
description = "Journal event based results implementation"
def __init__(self, args):
def __init__(self, args): # pylint: disable=W0613
"""
Creates an instance of ResultJournal.
......
......@@ -72,7 +72,7 @@ def __private():
spark.GenericScanner.tokenize(self, input_message)
return self.rv
def t_nl(self, s):
def t_nl(self, s): # pylint: disable=W0613
r'\n|\r\n'
self.rv.append(Token('nl'))
......
......@@ -62,7 +62,7 @@ class GenericScanner:
rv.append(self.makeRE('t_default'))
return '|'.join(rv)
def error(self, s, pos):
def error(self, s, pos): # pylint: disable=W0613
print("Lexical error at position %s" % pos)
raise SystemExit
......@@ -88,7 +88,7 @@ class GenericScanner:
self.index2func.has_key(i):
self.index2func[i](groups[i])
def t_default(self, s):
def t_default(self, s): # pylint: disable=W0613
r'( . | \n )+'
print("Specification error: unmatched input")
raise SystemExit
......@@ -307,7 +307,7 @@ class GenericParser:
self.newrules[lhs] = [rule]
self.new2old[rule] = oldrule
def typestring(self, token):
def typestring(self, token): # pylint: disable=W0613
return None
def error(self, token):
......
......@@ -622,7 +622,7 @@ class GDBServer(object):
#: ready to accept new connections
INIT_TIMEOUT = 5.0
def __init__(self, path='/usr/bin/gdbserver', port=None,
def __init__(self, path='/usr/bin/gdbserver', port=None, # pylint: disable=W0613
wait_until_running=True, *extra_args):
"""
Initializes a new gdbserver instance
......
......@@ -628,7 +628,7 @@ class SubProcess(object):
self._stdout_drainer.start()
self._stderr_drainer.start()
def signal_handler(signum, frame):
def signal_handler(signum, frame): # pylint: disable=W0613
self.result.interrupted = "signal/ctrl+c"
self.wait()
signal.default_int_handler()
......@@ -841,9 +841,8 @@ class GDBSubProcess(object):
Runs a subprocess inside the GNU Debugger
"""
def __init__(self, cmd, verbose=True,
allow_output_check=None, shell=False,
env=None, sudo=False, ignore_bg_processes=False, encoding=None):
def __init__(self, cmd, verbose=True, allow_output_check=None, shell=False, # pylint: disable=W0613
env=None, sudo=False, ignore_bg_processes=False, encoding=None): # pylint: disable=W0613
"""
Creates the subprocess object, stdout/err, reader threads and locks.
......@@ -945,7 +944,7 @@ class GDBSubProcess(object):
shutil.copy(self.binary, runtime.CURRENT_TEST.outputdir)
return core_path
def handle_break_hit(self, response):
def handle_break_hit(self, response): # pylint: disable=W0613
self.gdb.disconnect()
script_path, fifo_path = self.generate_gdb_connect_sh()
......@@ -964,7 +963,7 @@ class GDBSubProcess(object):
runtime.CURRENT_TEST.paused = ''
return ret
def handle_fatal_signal(self, response):
def handle_fatal_signal(self, response): # pylint: disable=W0613
script_path, fifo_path = self.generate_gdb_connect_sh()
msg = ("\n\nTEST PAUSED because inferior process received a FATAL SIGNAL. "
......@@ -1084,7 +1083,7 @@ class GDBSubProcess(object):
for command in genio.read_all_lines(prerun_commands_path):
self.gdb.cmd(command)
def run(self, timeout=None):
def run(self, timeout=None): # pylint: disable=W0613
for b in self._get_breakpoints():
self.gdb.set_break(b, ignore_error=True)
......
......@@ -18,7 +18,7 @@ class Sleep(JobPre, JobPost):
key_type=int,
default=3)
def sleep(self, job):
def sleep(self, job): # pylint: disable=W0613
for i in range(1, self.seconds + 1):
LOG_UI.info("Sleeping %2i/%s", i, self.seconds)
time.sleep(1)
......
......@@ -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,W0111,W0120,W0122,W0123,W0124,W0125,W0150,W0199,W0211,W0222,W0232,W0233,W0301,W0312,W0401,W0404,W0406,W0410,W0601,W0602,W0603,W0604,W0611,W0612,W0614,W0622,W0623,W0640,W0711,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1503,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,W0603,W0604,W0611,W0612,W0613,W0614,W0622,W0623,W0640,W0711,W1201,W1202,W1300,W1301,W1302,W1303,W1304,W1305,W1306,W1307,W1401,W1402,W1501,W1503,W1645"
if [ "$AVOCADO_PARALLEL_LINT" ]; then
LINT_CMD="$LINT_CMD --parallel=$AVOCADO_PARALLEL_LINT"
fi
......
......@@ -1197,7 +1197,7 @@ class PluginsXunitTest(AbsPluginsTest, unittest.TestCase):
super(PluginsXunitTest, self).setUp()
def run_and_check(self, testname, e_rc, e_ntests, e_nerrors,
e_nnotfound, e_nfailures, e_nskip):
e_nnotfound, e_nfailures, e_nskip): # pylint: disable=W0613
cmd_line = ('%s run --job-results-dir %s --sysinfo=off'
' --xunit - %s' % (AVOCADO, self.tmpdir, testname))
result = process.run(cmd_line, ignore_status=True)
......
......@@ -26,6 +26,7 @@ class Capabilities(unittest.TestCase):
def test_capabilities_pycdlib(self, has_pycdlib_mocked):
instance = iso9660.iso9660(self.iso_path, ['read', 'create', 'write'])
self.assertIsInstance(instance, iso9660.ISO9660PyCDLib)
self.assertTrue(has_pycdlib_mocked.called)
@mock.patch('avocado.utils.iso9660.has_pycdlib', return_value=False)
@mock.patch('avocado.utils.iso9660.has_isoinfo', return_value=False)
......@@ -34,6 +35,10 @@ class Capabilities(unittest.TestCase):
def test_capabilities_nobackend(self, has_pycdlib_mocked, has_isoinfo_mocked,
has_isoread_mocked, can_mount_mocked):
self.assertIsNone(iso9660.iso9660(self.iso_path, ['read']))
self.assertTrue(has_pycdlib_mocked.called)
self.assertTrue(has_isoinfo_mocked.called)
self.assertTrue(has_isoread_mocked.called)
self.assertTrue(can_mount_mocked.called)
def test_non_existing_capabilities(self):
self.assertIsNone(iso9660.iso9660(self.iso_path,
......
......@@ -34,12 +34,14 @@ class UtilsMemoryTestGetBuddyInfo(unittest.TestCase):
chunk_size = '0'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result[chunk_size], 6418)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_less_than_chunk_size(self, buddy_info_content_mocked):
chunk_size = '<2'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result['0'], 6418)
self.assertEqual(result['1'], 10439)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_less_than_equal_chunk_size(self, buddy_info_content_mocked):
chunk_size = '<=2'
......@@ -47,12 +49,14 @@ class UtilsMemoryTestGetBuddyInfo(unittest.TestCase):
self.assertEqual(result['0'], 6418)
self.assertEqual(result['1'], 10439)
self.assertEqual(result['2'], 10048)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_greater_than_chunk_size(self, buddy_info_content_mocked):
chunk_size = '>3'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result['4'], 19278)
self.assertEqual(result['5'], 10357)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_greater_than_equal_chunk_size(self, buddy_info_content_mocked):
chunk_size = '>=3'
......@@ -60,17 +64,20 @@ class UtilsMemoryTestGetBuddyInfo(unittest.TestCase):
self.assertEqual(result['3'], 12819)
self.assertEqual(result['4'], 19278)
self.assertEqual(result['5'], 10357)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_multiple_chunk_size(self, buddy_info_content_mocked):
chunk_size = '2 4'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result['2'], 10048)
self.assertEqual(result['4'], 19278)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_multiple_chunk_size_filtering_simple(self, buddy_info_content_mocked):
chunk_size = '>2 <4'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result['3'], 12819)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_multiple_chunk_size_filtering(self, buddy_info_content_mocked):
chunk_size = '>=2 <=4'
......@@ -78,21 +85,25 @@ class UtilsMemoryTestGetBuddyInfo(unittest.TestCase):
self.assertEqual(result['2'], 10048)
self.assertEqual(result['3'], 12819)
self.assertEqual(result['4'], 19278)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_multiple_chunk_size_filtering_invalid(self, buddy_info_content_mocked):
chunk_size = '>2 <2'
result = memory.get_buddy_info(chunk_size)
self.assertEqual(result, {})
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_filtering_node(self, buddy_info_content_mocked):
chunk_size = '0'
result = memory.get_buddy_info(chunk_size, nodes='1')
self.assertEqual(result[chunk_size], 5430)
self.assertTrue(buddy_info_content_mocked.called)
def test_get_buddy_info_filtering_zone(self, buddy_info_content_mocked):
chunk_size = '0'
result = memory.get_buddy_info(chunk_size, zones='DMA32')
self.assertEqual(result[chunk_size], 987)
self.assertTrue(buddy_info_content_mocked.called)
if __name__ == '__main__':
......
......@@ -94,7 +94,7 @@ class TestGDBProcess(unittest.TestCase):
self.assertIsInstance(process.split_gdb_expr('foo:debug_print'), tuple)
def mock_fail_find_cmd(cmd, default=None):
def mock_fail_find_cmd(cmd, default=None): # pylint: disable=W0613
path_paths = ["/usr/libexec", "/usr/local/sbin", "/usr/local/bin",
"/usr/sbin", "/usr/bin", "/sbin", "/bin"]
raise path.CmdNotFoundError(cmd, path_paths)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册