test_python_pylint.py: correct filepath passed to pylint
PATCH 1/1 test_python_pylint.py: correct filepath passed to pylint
From: Changqing Li <[email protected]>
we cannot get abspath of the added/modified file from info which is generated by unidiff, we can only get path like:
"scripts/lib/wic/plugins/source/bootimg-biosplusefi.py"
So pylint will responsed as "scripts/lib/wic/plugins/ source/bootimg-biosplusefi.py does not exist"
For modified file:
both pretest and test result have this error, so patchtest will take as no new error is introduced, so patchtest result is PASS
For new added file:
since test result have error "... does not exist", and pretest is empty, so patchtest will FAIL with error "... does not exist"
Fixed by add abspath like ".../openembedded-core/scripts/lib/wic /plugins/source/bootimg-biosplusefi.py" for the file
[YOCTO #13428]
--- tests/test_python_pylint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tests/test_python_pylint.py +5 -3
@@ -18,6 +18,7 @@ import base import patchtestdata import pylint.epylint as lint +import os class PyLint(base.Base): pythonpatches = []
@@ -45,7 +46,8 @@ 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) + filepath = os.path.join(os.path.abspath(patchtestdata.PatchTestInput.repodir), pythonpatch.path) + (pylint_stdout, pylint_stderr) = lint.py_run(command_options = filepath + self.pylint_options, return_std=True) for line in pylint_stdout.readlines(): if not '*' in line: if line.strip():
@@ -59,12 +61,12 @@ 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) + filepath = os.path.join(os.path.abspath(patchtestdata.PatchTestInput.repodir), path) + (pylint_stdout, pylint_stderr) = lint.py_run(command_options = filepath + self.pylint_options, return_std=True) for line in pylint_stdout.readlines(): if not '*' in line: if line.strip(): self.pylint_test[line.strip().split(' ',1)[0]] = line.strip().split(' ',1)[1] - for issue in self.pylint_test: if self.pylint_test[issue] not in self.pylint_pretest.values(): self.fail('Errors in your Python code were encountered',
Signature · 1 line
2.7.4