diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2023-10-31 14:16:13 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-11-01 19:19:40 +0000 |
commit | 3ad5aa3f16fbef700db2934edc83250650498b28 (patch) | |
tree | 22267b49198528b93b38ab148f6ed475d3e8e5f2 /meta/lib/patchtest | |
parent | 2bddb6bb97075a2dd8e988867e0ee6e4556d2924 (diff) | |
download | poky-3ad5aa3f16fbef700db2934edc83250650498b28.tar.gz |
patchtest: make pylint tests compatible with 3.x
pylint 3.x has removed epylint, which is now a separate module. To avoid
adding another recipe or using outdated modules, modify the
test_python_pylint tests so that they use the standard pylint API.
(From OE-Core rev: 72be3d6a116febf46130cccbe12afe5ad93779b5)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/patchtest')
-rw-r--r-- | meta/lib/patchtest/tests/test_python_pylint.py | 17 |
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 | ||
7 | import base | 7 | import base |
8 | from io import StringIO | ||
8 | from data import PatchTestInput | 9 | from data import PatchTestInput |
9 | import pylint.epylint as lint | 10 | from pylint.reporters.text import TextReporter |
11 | import pylint.lint as lint | ||
12 | |||
10 | 13 | ||
11 | class PyLint(base.Base): | 14 | class 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] |