summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/patchtest/tests/test_python_pylint.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/meta/lib/patchtest/tests/test_python_pylint.py b/meta/lib/patchtest/tests/test_python_pylint.py
index 304b2d5ee9..ef315e591c 100644
--- a/meta/lib/patchtest/tests/test_python_pylint.py
+++ b/meta/lib/patchtest/tests/test_python_pylint.py
@@ -5,8 +5,11 @@
5# SPDX-License-Identifier: GPL-2.0-only 5# SPDX-License-Identifier: GPL-2.0-only
6 6
7import base 7import base
8from io import StringIO
8from data import PatchTestInput 9from data import PatchTestInput
9import pylint.epylint as lint 10from pylint.reporters.text import TextReporter
11import pylint.lint as lint
12
10 13
11class PyLint(base.Base): 14class PyLint(base.Base):
12 pythonpatches = [] 15 pythonpatches = []
@@ -32,8 +35,10 @@ class PyLint(base.Base):
32 def pretest_pylint(self): 35 def pretest_pylint(self):
33 for pythonpatch in self.pythonpatches: 36 for pythonpatch in self.pythonpatches:
34 if pythonpatch.is_modified_file: 37 if pythonpatch.is_modified_file:
35 (pylint_stdout, pylint_stderr) = lint.py_run(command_options = pythonpatch.path + self.pylint_options, return_std=True) 38 pylint_output = StringIO()
36 for line in pylint_stdout.readlines(): 39 reporter = TextReporter(pylint_output)
40 lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, exit=False)
41 for line in pylint_output.readlines():
37 if not '*' in line: 42 if not '*' in line:
38 if line.strip(): 43 if line.strip():
39 self.pylint_pretest[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] 44 self.pylint_pretest[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1]
@@ -46,8 +51,10 @@ class PyLint(base.Base):
46 path = pythonpatch.target_file[2:] 51 path = pythonpatch.target_file[2:]
47 else: 52 else:
48 path = pythonpatch.path 53 path = pythonpatch.path
49 (pylint_stdout, pylint_stderr) = lint.py_run(command_options = path + self.pylint_options, return_std=True) 54 pylint_output = StringIO()
50 for line in pylint_stdout.readlines(): 55 reporter = TextReporter(pylint_output)
56 lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, exit=False)
57 for line in pylint_output.readlines():
51 if not '*' in line: 58 if not '*' in line:
52 if line.strip(): 59 if line.strip():
53 self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] 60 self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1]