Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 154F2E00D89; Wed, 31 Jul 2019 02:36:12 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, * medium trust * [192.103.53.11 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail5.wrs.com (mail5.windriver.com [192.103.53.11]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8CE59E00D33 for ; Wed, 31 Jul 2019 02:36:11 -0700 (PDT) Received: from ALA-HCB.corp.ad.wrs.com (ala-hcb.corp.ad.wrs.com [147.11.189.41]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id x6V9ZoQ6022941 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL) for ; Wed, 31 Jul 2019 02:36:00 -0700 Received: from pek-lpg-core2.corp.ad.wrs.com (128.224.153.41) by ALA-HCB.corp.ad.wrs.com (147.11.189.41) with Microsoft SMTP Server id 14.3.468.0; Wed, 31 Jul 2019 02:35:32 -0700 From: To: Date: Wed, 31 Jul 2019 17:35:31 +0800 Message-ID: <1564565731-436468-1-git-send-email-changqing.li@windriver.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [patchtest-oe][PATCH] test_python_pylint.py: correct filepath passed to pylint X-BeenThere: yocto@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Discussion of all things Yocto Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jul 2019 09:36:12 -0000 Content-Type: text/plain From: Changqing Li 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] Signed-off-by: Changqing Li --- tests/test_python_pylint.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_python_pylint.py b/tests/test_python_pylint.py index df6a5de..b6c8d4d 100644 --- a/tests/test_python_pylint.py +++ b/tests/test_python_pylint.py @@ -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', -- 2.7.4