[prev in list] [next in list] [prev in thread] [next in thread]
List: openembedded-core
Subject: [OE-core][PATCH] patchtest: make pylint tests compatible with 3.x
From: "Trevor Gamblin" <tgamblin () baylibre ! com>
Date: 2023-10-31 18:16:13
Message-ID: 20231031181614.2092124-1-tgamblin () baylibre ! com
[Download RAW message or body]
Content-Transfer-Encoding: 8bit
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.
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
---
meta/lib/patchtest/tests/test_python_pylint.py | 17 ++++++++++++-----
1 file 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 304b2d5ee9a..ef315e591ca \
100644
--- a/meta/lib/patchtest/tests/test_python_pylint.py
+++ b/meta/lib/patchtest/tests/test_python_pylint.py
@@ -5,8 +5,11 @@
# SPDX-License-Identifier: GPL-2.0-only
import base
+from io import StringIO
from data import PatchTestInput
-import pylint.epylint as lint
+from pylint.reporters.text import TextReporter
+import pylint.lint as lint
+
class PyLint(base.Base):
pythonpatches = []
@@ -32,8 +35,10 @@ class PyLint(base.Base):
def pretest_pylint(self):
for pythonpatch in self.pythonpatches:
if pythonpatch.is_modified_file:
- (pylint_stdout, pylint_stderr) = lint.py_run(command_options = \
pythonpatch.path + self.pylint_options, return_std=True)
- for line in pylint_stdout.readlines():
+ pylint_output = StringIO()
+ reporter = TextReporter(pylint_output)
+ lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, \
exit=False) + for line in pylint_output.readlines():
if not '*' in line:
if line.strip():
self.pylint_pretest[line.strip().split(' ',1)[0]] = \
line.strip().split(' ',1)[1] @@ -46,8 +51,10 @@ class PyLint(base.Base):
path = pythonpatch.target_file[2:]
else:
path = pythonpatch.path
- (pylint_stdout, pylint_stderr) = lint.py_run(command_options = path + \
self.pylint_options, return_std=True)
- for line in pylint_stdout.readlines():
+ pylint_output = StringIO()
+ reporter = TextReporter(pylint_output)
+ lint.Run([self.pylint_options, pythonpatch.path], reporter=reporter, \
exit=False) + for line in pylint_output.readlines():
if not '*' in line:
if line.strip():
self.pylint_test[line.strip().split(' ',1)[0]] = \
line.strip().split(' ',1)[1]
--
2.41.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#189867): https://lists.openembedded.org/g/openembedded-core/message/189867
Mute This Topic: https://lists.openembedded.org/mt/102303546/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic