From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634658312703152.35625343637923; Tue, 19 Oct 2021 08:45:12 -0700 (PDT) Received: from localhost ([::1]:44142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrId-0004aH-NB for importer@patchew.org; Tue, 19 Oct 2021 11:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44610) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQk-0001R5-KY for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQf-000816-Tp for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-424-a4P1Nm3KOlmlZ-bWGHZ8jA-1; Tue, 19 Oct 2021 10:49:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 250F711B4C00; Tue, 19 Oct 2021 14:49:21 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27A005F4E0; Tue, 19 Oct 2021 14:49:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gFN5HkVnwSJHDwa5VA8vEXZe4FujxOdTMuaJiULY1Ns=; b=Et9SFew6/zAZBOxDEAIQI9e2v7+aHevdEnjpywXEJcFZERR7NdZRlCbcaGQuyr+8HneIhQ WfefX6pdfq/QrhtFEFDUjXZlWocLNfAMfWjQdPS0QkJZJqkNNwYKGIEZmfbvfGnsA7XRrd HlzwicgwACNH/L5twU/IkWyXzfuObcQ= X-MC-Unique: a4P1Nm3KOlmlZ-bWGHZ8jA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 01/15] iotests/297: Move pylint config into pylintrc Date: Tue, 19 Oct 2021 10:49:04 -0400 Message-Id: <20211019144918.3159078-2-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634658313607000001 Content-Type: text/plain; charset="utf-8" Move --score=3Dn and --notes=3DXXX,FIXME into pylintrc. This pulls configuration out of code, which I think is probably a good thing in general. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 4 +--- tests/qemu-iotests/pylintrc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 91ec34d9521..bc3a0ceb2aa 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -65,10 +65,8 @@ def run_linters(): print('=3D=3D=3D pylint =3D=3D=3D') sys.stdout.flush() =20 - # Todo notes are fine, but fixme's or xxx's should probably just be - # fixed (in tests, at least) env =3D os.environ.copy() - subprocess.run(('pylint-3', '--score=3Dn', '--notes=3DFIXME,XXX', *fil= es), + subprocess.run(('pylint-3', *files), env=3Denv, check=3DFalse) =20 print('=3D=3D=3D mypy =3D=3D=3D') diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc index 8cb4e1d6a6d..32ab77b8bb9 100644 --- a/tests/qemu-iotests/pylintrc +++ b/tests/qemu-iotests/pylintrc @@ -31,6 +31,22 @@ disable=3Dinvalid-name, too-many-statements, consider-using-f-string, =20 + +[REPORTS] + +# Activate the evaluation score. +score=3Dno + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +# TODO notes are fine, but FIXMEs or XXXs should probably just be +# fixed (in tests, at least). +notes=3DFIXME, + XXX, + + [FORMAT] =20 # Maximum number of characters on a single line. --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634659881859492.6666273427894; Tue, 19 Oct 2021 09:11:21 -0700 (PDT) Received: from localhost ([::1]:49054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrhv-0004iW-Ql for importer@patchew.org; Tue, 19 Oct 2021 12:11:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44572) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQj-0001Qz-Ad for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:42588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQe-00080d-Ti for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:28 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-zZe-5RxRMQSj_aDpxGmr7Q-1; Tue, 19 Oct 2021 10:49:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2B60F101F001; Tue, 19 Oct 2021 14:49:22 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50B2A5D6D7; Tue, 19 Oct 2021 14:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ntV7nxemO6jbrlF9Kwwy+ovD9pcR4W4Dbt7SkBNUns0=; b=Gcn4G5yWu7P7eLnnPbk4orXALaVc4TBiIipZDF+r+ehuJW/Jxy1+SYKpQXe0FGNk/Z8cgX +ssLGvk34jVKOsL+zoYabcyDsLvoYxUer9B4bl/ya0GTpyvqBCY31Xj71zdA72kuhvoNw1 2Y9SGxtLACIv+4tBJPsvgJnF17RwQvk= X-MC-Unique: zZe-5RxRMQSj_aDpxGmr7Q-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 02/15] iotests/297: Split mypy configuration out into mypy.ini Date: Tue, 19 Oct 2021 10:49:05 -0400 Message-Id: <20211019144918.3159078-3-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634659883486100001 Content-Type: text/plain; charset="utf-8" More separation of code and configuration. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 14 +------------- tests/qemu-iotests/mypy.ini | 12 ++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) create mode 100644 tests/qemu-iotests/mypy.ini diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index bc3a0ceb2aa..b8101e6024a 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -73,19 +73,7 @@ def run_linters(): sys.stdout.flush() =20 env['MYPYPATH'] =3D env['PYTHONPATH'] - p =3D subprocess.run(('mypy', - '--warn-unused-configs', - '--disallow-subclassing-any', - '--disallow-any-generics', - '--disallow-incomplete-defs', - '--disallow-untyped-decorators', - '--no-implicit-optional', - '--warn-redundant-casts', - '--warn-unused-ignores', - '--no-implicit-reexport', - '--namespace-packages', - '--scripts-are-modules', - *files), + p =3D subprocess.run(('mypy', *files), env=3Denv, check=3DFalse, stdout=3Dsubprocess.PIPE, diff --git a/tests/qemu-iotests/mypy.ini b/tests/qemu-iotests/mypy.ini new file mode 100644 index 00000000000..4c0339f5589 --- /dev/null +++ b/tests/qemu-iotests/mypy.ini @@ -0,0 +1,12 @@ +[mypy] +disallow_any_generics =3D True +disallow_incomplete_defs =3D True +disallow_subclassing_any =3D True +disallow_untyped_decorators =3D True +implicit_reexport =3D False +namespace_packages =3D True +no_implicit_optional =3D True +scripts_are_modules =3D True +warn_redundant_casts =3D True +warn_unused_configs =3D True +warn_unused_ignores =3D True --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634659698750409.31022397577976; Tue, 19 Oct 2021 09:08:18 -0700 (PDT) Received: from localhost ([::1]:40462 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrez-0007Lb-Ab for importer@patchew.org; Tue, 19 Oct 2021 12:08:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQk-0001R3-0C for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQg-00081b-OC for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-Ey0szTMePhGfxzcUQx9ZMg-1; Tue, 19 Oct 2021 10:49:24 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5575D81C464; Tue, 19 Oct 2021 14:49:23 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 551795D6D7; Tue, 19 Oct 2021 14:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7yNFTkEkdMRw1gtMrcY1seNDCUcqqL4Yv9wyvzTXCz4=; b=iesaBtTlyEQwvG3rb+MZp/42Kr9BorhPicbBerAD8134q+MvL0fvVqNDNo1CIe1ml/SHiJ ss+TmwHtOwXA5q6tu6kuhlf/BdABJNmA9HQHVqaaM6gXl/vwLVK7QrSJ64OEVMiX4ly80e BSmsgXeV8jS1uZFOiGPqT//vbk+oBRc= X-MC-Unique: Ey0szTMePhGfxzcUQx9ZMg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 03/15] iotests/297: Add get_files() function Date: Tue, 19 Oct 2021 10:49:06 -0400 Message-Id: <20211019144918.3159078-4-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634659698993100001 Content-Type: text/plain; charset="utf-8" Split out file discovery into its own method to begin separating out configuration/setup and test execution. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index b8101e6024a..15b54594c11 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -21,6 +21,7 @@ import re import shutil import subprocess import sys +from typing import List =20 import iotests =20 @@ -54,10 +55,14 @@ def is_python_file(filename): return False =20 =20 -def run_linters(): +def get_test_files() -> List[str]: named_tests =3D [f'tests/{entry}' for entry in os.listdir('tests')] check_tests =3D set(os.listdir('.') + named_tests) - set(SKIP_FILES) - files =3D [filename for filename in check_tests if is_python_file(file= name)] + return list(filter(is_python_file, check_tests)) + + +def run_linters(): + files =3D get_test_files() =20 iotests.logger.debug('Files to be checked:') iotests.logger.debug(', '.join(sorted(files))) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634659855662409.5555766498593; Tue, 19 Oct 2021 09:10:55 -0700 (PDT) Received: from localhost ([::1]:46936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrhW-0003EM-Cy for importer@patchew.org; Tue, 19 Oct 2021 12:10:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQl-0001Tf-Ls for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:58478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQi-00083W-SI for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:31 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-i-jv23YuPm2zE5SOFJ4FKg-1; Tue, 19 Oct 2021 10:49:26 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 574C33FAB; Tue, 19 Oct 2021 14:49:25 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CBE65D6D7; Tue, 19 Oct 2021 14:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654967; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gm7pIPvcRuFxpx5kWTYrT3/cHu9puBfBy1brY0EZPPA=; b=MpCjP5Io4Oy5a+4x34neUgUo1rz7t6KIjC0U+6y9p/lwkMtgkAwOzS265qtXpEyu3Ml0A8 AoA6x81j4wLUVINGmhhl1ETa04u06G0jE8JPGxc0vM+kpKpGbdfIGXIXIlYt+GDcaVHFdF /nhU+9Y+u9ZzLWV/LSkeuATv1+CaOD8= X-MC-Unique: i-jv23YuPm2zE5SOFJ4FKg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 04/15] iotests/297: Create main() function Date: Tue, 19 Oct 2021 10:49:07 -0400 Message-Id: <20211019144918.3159078-5-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634659856439100001 Instead of running "run_linters" directly, create a main() function that will be responsible for environment setup, leaving run_linters() responsible only for execution of the linters. (That environment setup will be moved over in forthcoming commits.) Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 15b54594c11..163ebc8ebfd 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -89,8 +89,12 @@ def run_linters(): print(p.stdout) =20 =20 -for linter in ('pylint-3', 'mypy'): - if shutil.which(linter) is None: - iotests.notrun(f'{linter} not found') +def main() -> None: + for linter in ('pylint-3', 'mypy'): + if shutil.which(linter) is None: + iotests.notrun(f'{linter} not found') =20 -iotests.script_main(run_linters) + run_linters() + + +iotests.script_main(main) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634660014375729.0593745551536; Tue, 19 Oct 2021 09:13:34 -0700 (PDT) Received: from localhost ([::1]:57614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrk5-0001zK-7M for importer@patchew.org; Tue, 19 Oct 2021 12:13:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQm-0001Wp-LV for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQk-00084L-Dh for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:32 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-509-3cTj0C7FMROFLVYzp5TkcQ-1; Tue, 19 Oct 2021 10:49:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0FBF196632E; Tue, 19 Oct 2021 14:49:26 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 81DB35D6D7; Tue, 19 Oct 2021 14:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mvsIY99tLvR/A21zOAXqSW8L6kqR0IEX1e3u11FwDq0=; b=UWQiZNYKmHnzxAQ5ldIx9bYE1lM8MpTj1UyGyavliMKw0Mda4CE2FW/hc94rlR/FWLb2+I nrrNlMkzN8jT2/IXynMQsJuXd9zsvBsripGMZmCIbjy8lavuOYe6Bxk/lEUI9ZRbkRVBJ8 GhKMByxIVFPVH2WVys9wqZsMPDh3o2g= X-MC-Unique: 3cTj0C7FMROFLVYzp5TkcQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 05/15] iotests/297: Don't rely on distro-specific linter binaries Date: Tue, 19 Oct 2021 10:49:08 -0400 Message-Id: <20211019144918.3159078-6-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Vladimir Sementsov-Ogievskiy , Eduardo Habkost , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660015408100001 'pylint-3' is another Fedora-ism. Use "python3 -m pylint" or "python3 -m mypy" to access these scripts instead. This style of invocation will prefer the "correct" tool when run in a virtual environment. Note that we still check for "pylint-3" before the test begins -- this check is now "overly strict", but shouldn't cause anything that was already running correctly to start failing. This is addressed by a commit later in this series; 'iotests/297: update tool availability checks'. Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 163ebc8ebfd..c1bddb9ce0e 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -71,14 +71,14 @@ def run_linters(): sys.stdout.flush() =20 env =3D os.environ.copy() - subprocess.run(('pylint-3', *files), + subprocess.run(('python3', '-m', 'pylint', *files), env=3Denv, check=3DFalse) =20 print('=3D=3D=3D mypy =3D=3D=3D') sys.stdout.flush() =20 env['MYPYPATH'] =3D env['PYTHONPATH'] - p =3D subprocess.run(('mypy', *files), + p =3D subprocess.run(('python3', '-m', 'mypy', *files), env=3Denv, check=3DFalse, stdout=3Dsubprocess.PIPE, --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634659971264438.5285946784692; Tue, 19 Oct 2021 09:12:51 -0700 (PDT) Received: from localhost ([::1]:55416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrjO-0000V0-87 for importer@patchew.org; Tue, 19 Oct 2021 12:12:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44756) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQq-0001hz-Cg for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:34573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQm-00087V-Ka for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-nuD_bf07Mm-j5vwgVrIM_w-1; Tue, 19 Oct 2021 10:49:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B361C11B4C04; Tue, 19 Oct 2021 14:49:27 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C90335D6D7; Tue, 19 Oct 2021 14:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=51eD+Sk87Ad/lpyURfgeLuBgtkm367QKEQ1SxZoyY5Y=; b=M7SpGkNBZj8IuHz2SQY6rtLm+udfpcOSp6TXeqIT6jBBDPv+JJlOvZa1ucRXP4MqiCxKHp +wp7OPmBty/YeCNHM2RTf3T9VlWmLTX2yVgnjw5WPQZW0wUC8qy+10t6gTgFY+9UD5X4vm mwrG8DrIBzjxiRhZNvZFO0AuyWu0hCc= X-MC-Unique: nuD_bf07Mm-j5vwgVrIM_w-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 06/15] iotests/297: Split run_linters apart into run_pylint and run_mypy Date: Tue, 19 Oct 2021 10:49:09 -0400 Message-Id: <20211019144918.3159078-7-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634659972503100001 Content-Type: text/plain; charset="utf-8" Move environment setup into main(), and split the actual linter execution into run_pylint and run_mypy, respectively. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index c1bddb9ce0e..189bcaf5f94 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -21,7 +21,7 @@ import re import shutil import subprocess import sys -from typing import List +from typing import List, Mapping, Optional =20 import iotests =20 @@ -61,23 +61,19 @@ def get_test_files() -> List[str]: return list(filter(is_python_file, check_tests)) =20 =20 -def run_linters(): - files =3D get_test_files() +def run_pylint( + files: List[str], + env: Optional[Mapping[str, str]] =3D None, +) -> None: =20 - iotests.logger.debug('Files to be checked:') - iotests.logger.debug(', '.join(sorted(files))) - - print('=3D=3D=3D pylint =3D=3D=3D') - sys.stdout.flush() - - env =3D os.environ.copy() subprocess.run(('python3', '-m', 'pylint', *files), env=3Denv, check=3DFalse) =20 - print('=3D=3D=3D mypy =3D=3D=3D') - sys.stdout.flush() =20 - env['MYPYPATH'] =3D env['PYTHONPATH'] +def run_mypy( + files: List[str], + env: Optional[Mapping[str, str]] =3D None, +) -> None: p =3D subprocess.run(('python3', '-m', 'mypy', *files), env=3Denv, check=3DFalse, @@ -94,7 +90,21 @@ def main() -> None: if shutil.which(linter) is None: iotests.notrun(f'{linter} not found') =20 - run_linters() + files =3D get_test_files() + + iotests.logger.debug('Files to be checked:') + iotests.logger.debug(', '.join(sorted(files))) + + env =3D os.environ.copy() + env['MYPYPATH'] =3D env['PYTHONPATH'] + + print('=3D=3D=3D pylint =3D=3D=3D') + sys.stdout.flush() + run_pylint(files, env=3Denv) + + print('=3D=3D=3D mypy =3D=3D=3D') + sys.stdout.flush() + run_mypy(files, env=3Denv) =20 =20 iotests.script_main(main) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634657106603351.28148271477914; Tue, 19 Oct 2021 08:25:06 -0700 (PDT) Received: from localhost ([::1]:50534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcqzA-0004Cp-M9 for importer@patchew.org; Tue, 19 Oct 2021 11:25:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44750) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQp-0001g6-U1 for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:38246) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQn-00088G-S3 for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-Wk6c-0KONfiwvxpW3A7DFg-1; Tue, 19 Oct 2021 10:49:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08C5581CBE5; Tue, 19 Oct 2021 14:49:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15DEA5D6D7; Tue, 19 Oct 2021 14:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wshAB3qVRvaSBfYxC9gpbHDY1X+CTTPAnvCTF1KcMoo=; b=JcqXnB5iSqoi21wsExf6fh3odpXoINuBQKr0acuTZkP2bxn9nE7MKc1cyRJv+QESq5uxLk /lrNCC1h4/hFMTkVWiHhG4PH9olHrHPpH5oaPEr3DuIXQ4GZ3uZyrrcvXgO1A7Bf13AEA2 3TjbXrPjw3AyhKnWjGGiEPw5DEpWD+0= X-MC-Unique: Wk6c-0KONfiwvxpW3A7DFg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 07/15] iotests/297: refactor run_[mypy|pylint] as generic execution shim Date: Tue, 19 Oct 2021 10:49:10 -0400 Message-Id: <20211019144918.3159078-8-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634657107286100001 Content-Type: text/plain; charset="utf-8" There's virtually nothing special here anymore; we can combine these into a single, rather generic function. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 189bcaf5f94..d21673a2929 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -61,27 +61,29 @@ def get_test_files() -> List[str]: return list(filter(is_python_file, check_tests)) =20 =20 -def run_pylint( - files: List[str], - env: Optional[Mapping[str, str]] =3D None, +def run_linter( + tool: str, + args: List[str], + env: Optional[Mapping[str, str]] =3D None, + suppress_output: bool =3D False, ) -> None: + """ + Run a python-based linting tool. =20 - subprocess.run(('python3', '-m', 'pylint', *files), - env=3Denv, check=3DFalse) + If suppress_output is True, capture stdout/stderr of the child + process and only print that information back to stdout if the child + process's return code was non-zero. + """ + p =3D subprocess.run( + ('python3', '-m', tool, *args), + env=3Denv, + check=3DFalse, + stdout=3Dsubprocess.PIPE if suppress_output else None, + stderr=3Dsubprocess.STDOUT if suppress_output else None, + universal_newlines=3DTrue, + ) =20 - -def run_mypy( - files: List[str], - env: Optional[Mapping[str, str]] =3D None, -) -> None: - p =3D subprocess.run(('python3', '-m', 'mypy', *files), - env=3Denv, - check=3DFalse, - stdout=3Dsubprocess.PIPE, - stderr=3Dsubprocess.STDOUT, - universal_newlines=3DTrue) - - if p.returncode !=3D 0: + if suppress_output and p.returncode !=3D 0: print(p.stdout) =20 =20 @@ -100,11 +102,11 @@ def main() -> None: =20 print('=3D=3D=3D pylint =3D=3D=3D') sys.stdout.flush() - run_pylint(files, env=3Denv) + run_linter('pylint', files, env=3Denv) =20 print('=3D=3D=3D mypy =3D=3D=3D') sys.stdout.flush() - run_mypy(files, env=3Denv) + run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) =20 =20 iotests.script_main(main) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634660240666605.9813393325235; Tue, 19 Oct 2021 09:17:20 -0700 (PDT) Received: from localhost ([::1]:39154 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrnj-00007b-En for importer@patchew.org; Tue, 19 Oct 2021 12:17:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44760) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQq-0001j9-Mj for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:51279) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQo-0008AD-Qx for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-593-wSI72nSJMHarpf2TiJWx-g-1; Tue, 19 Oct 2021 10:49:31 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24118343CF; Tue, 19 Oct 2021 14:49:30 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35E805D6D7; Tue, 19 Oct 2021 14:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654974; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/U3/3OVl7a1y6D0eRK3j95NvD8mHtj55kju4dXIHFb4=; b=OWuVY2ZshvmgMbqTF/MRUqjm1ABJjuGs0odwqbEiq8FfXId8iYA8FxihiHLVn1+OtuUrD7 11DiQLzChZi0YUjapVS+PK4IfoFFQDBqDfMKVhM4/I8+Hy73vpyfPgHClI1Vkhp+OkUmvj CkMLZsL/GGhKCKKhQ1QEhDzqvApgXkk= X-MC-Unique: wSI72nSJMHarpf2TiJWx-g-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 08/15] iotests/297: Change run_linter() to raise an exception on failure Date: Tue, 19 Oct 2021 10:49:11 -0400 Message-Id: <20211019144918.3159078-9-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660241143100001 Content-Type: text/plain; charset="utf-8" Instead of using a process return code as the python function return value (or just not returning anything at all), allow run_linter() to raise an exception instead. The responsibility for printing output on error shifts from the function itself to the caller, who will know best how to present/format that information. (Also, "suppress_output" is now a lot more accurate of a parameter name.) Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index d21673a2929..76d6a23f531 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -70,22 +70,18 @@ def run_linter( """ Run a python-based linting tool. =20 - If suppress_output is True, capture stdout/stderr of the child - process and only print that information back to stdout if the child - process's return code was non-zero. + :param suppress_output: If True, suppress all stdout/stderr output. + :raise CalledProcessError: If the linter process exits with failure. """ - p =3D subprocess.run( + subprocess.run( ('python3', '-m', tool, *args), env=3Denv, - check=3DFalse, + check=3DTrue, stdout=3Dsubprocess.PIPE if suppress_output else None, stderr=3Dsubprocess.STDOUT if suppress_output else None, universal_newlines=3DTrue, ) =20 - if suppress_output and p.returncode !=3D 0: - print(p.stdout) - =20 def main() -> None: for linter in ('pylint-3', 'mypy'): @@ -102,11 +98,19 @@ def main() -> None: =20 print('=3D=3D=3D pylint =3D=3D=3D') sys.stdout.flush() - run_linter('pylint', files, env=3Denv) + try: + run_linter('pylint', files, env=3Denv) + except subprocess.CalledProcessError: + # pylint failure will be caught by diffing the IO. + pass =20 print('=3D=3D=3D mypy =3D=3D=3D') sys.stdout.flush() - run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) + try: + run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) + except subprocess.CalledProcessError as exc: + if exc.output: + print(exc.output) =20 =20 iotests.script_main(main) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634660105177338.5090846033137; Tue, 19 Oct 2021 09:15:05 -0700 (PDT) Received: from localhost ([::1]:35574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrlY-000647-2b for importer@patchew.org; Tue, 19 Oct 2021 12:15:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQr-0001lw-Ny for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:40008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQq-0008Af-3s for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:37 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-564-Qc5XaEPbMJmshIJiJr2h1Q-1; Tue, 19 Oct 2021 10:49:32 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3134881E20C; Tue, 19 Oct 2021 14:49:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50BF25D6D7; Tue, 19 Oct 2021 14:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i4QoQLHos0sHo8mJLAtEuZcoHQUyZPuhbO0V7tN3Iyk=; b=L+U+di9kjNhDtaWWD6Ny0LsJZCWJRy7bf+228OpFoppEBt2ZstxNLw+xsDUsoSGlp/SvoX qB9iurUfiFITO/f8znmHOYp4JMfJYBGHcL4dOuXC4CK8VnuiJzHjbhA1c6ZZMzq5rDEh7l 7RdEqc1+2PYSer2vbasYyEa5mMAuBAw= X-MC-Unique: Qc5XaEPbMJmshIJiJr2h1Q-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 09/15] iotests/297: update tool availability checks Date: Tue, 19 Oct 2021 10:49:12 -0400 Message-Id: <20211019144918.3159078-10-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660106520100001 Content-Type: text/plain; charset="utf-8" As mentioned in 'iotests/297: Don't rely on distro-specific linter binaries', these checks are overly strict. Update them to be in-line with how we actually invoke the linters themselves. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 76d6a23f531..b2ad8d1cbe0 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -18,7 +18,6 @@ =20 import os import re -import shutil import subprocess import sys from typing import List, Mapping, Optional @@ -84,9 +83,11 @@ def run_linter( =20 =20 def main() -> None: - for linter in ('pylint-3', 'mypy'): - if shutil.which(linter) is None: - iotests.notrun(f'{linter} not found') + for linter in ('pylint', 'mypy'): + try: + run_linter(linter, ['--version'], suppress_output=3DTrue) + except subprocess.CalledProcessError: + iotests.notrun(f"'{linter}' not found") =20 files =3D get_test_files() =20 --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16346604175460.6322073149088965; Tue, 19 Oct 2021 09:20:17 -0700 (PDT) Received: from localhost ([::1]:49136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrqa-0006g5-2j for importer@patchew.org; Tue, 19 Oct 2021 12:20:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQs-0001pK-Ur for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:52280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQr-0008BS-3A for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:38 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-XpMu-CIZMrG67SmRP5dxLg-1; Tue, 19 Oct 2021 10:49:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 40DDA101F001; Tue, 19 Oct 2021 14:49:32 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AE7C5D6D7; Tue, 19 Oct 2021 14:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MVtyAdbRBc2Y0+kMVQs8JXlxwsZDnAEVndjgEBtkfKw=; b=g1QAekP/7PH4VUDqfxj5i5siYbsHvn3RjJWaDUYjHp5XC/3TjNk+xIoYtYAyWFBwR+aG1H 5Lg4RZRMA/PvPAmdz/nrL+KP1HPLsfBRtBmODJLtsdbnc/TdyLsO3jnZh1IhAtDMy3RoYO yHYvFfHzulQ8ZgU9OJEfntmoxtSsPVA= X-MC-Unique: XpMu-CIZMrG67SmRP5dxLg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 10/15] iotests/297: split test into sub-cases Date: Tue, 19 Oct 2021 10:49:13 -0400 Message-Id: <20211019144918.3159078-11-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660418142100001 Content-Type: text/plain; charset="utf-8" Take iotest 297's main() test function and split it into two sub-cases that can be skipped individually. We can also drop custom environment setup from the pylint test as it isn't needed. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 63 ++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index b2ad8d1cbe0..b7d9d6077b3 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -82,36 +82,51 @@ def run_linter( ) =20 =20 +def check_linter(linter: str) -> bool: + try: + run_linter(linter, ['--version'], suppress_output=3DTrue) + except subprocess.CalledProcessError: + iotests.case_notrun(f"'{linter}' not found") + return False + return True + + +def test_pylint(files: List[str]) -> None: + print('=3D=3D=3D pylint =3D=3D=3D') + sys.stdout.flush() + + if not check_linter('pylint'): + return + + run_linter('pylint', files) + + +def test_mypy(files: List[str]) -> None: + print('=3D=3D=3D mypy =3D=3D=3D') + sys.stdout.flush() + + if not check_linter('mypy'): + return + + env =3D os.environ.copy() + env['MYPYPATH'] =3D env['PYTHONPATH'] + + run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) + + def main() -> None: - for linter in ('pylint', 'mypy'): - try: - run_linter(linter, ['--version'], suppress_output=3DTrue) - except subprocess.CalledProcessError: - iotests.notrun(f"'{linter}' not found") - files =3D get_test_files() =20 iotests.logger.debug('Files to be checked:') iotests.logger.debug(', '.join(sorted(files))) =20 - env =3D os.environ.copy() - env['MYPYPATH'] =3D env['PYTHONPATH'] - - print('=3D=3D=3D pylint =3D=3D=3D') - sys.stdout.flush() - try: - run_linter('pylint', files, env=3Denv) - except subprocess.CalledProcessError: - # pylint failure will be caught by diffing the IO. - pass - - print('=3D=3D=3D mypy =3D=3D=3D') - sys.stdout.flush() - try: - run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) - except subprocess.CalledProcessError as exc: - if exc.output: - print(exc.output) + for test in (test_pylint, test_mypy): + try: + test(files) + except subprocess.CalledProcessError as exc: + # Linter failure will be caught by diffing the IO. + if exc.output: + print(exc.output) =20 =20 iotests.script_main(main) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634657339797138.33996516042475; Tue, 19 Oct 2021 08:28:59 -0700 (PDT) Received: from localhost ([::1]:59108 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr2w-0001jh-Mx for importer@patchew.org; Tue, 19 Oct 2021 11:28:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqR0-0001tc-04 for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59265) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQu-0008Dq-KX for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-207-RlWibRZkOHSeP-a1OrQWSQ-1; Tue, 19 Oct 2021 10:49:34 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 498B8824FA2; Tue, 19 Oct 2021 14:49:33 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65E795D6D7; Tue, 19 Oct 2021 14:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X2iVq2o0JZLP5OeiUiiheqEHME/hF8JHrhZdN7Kas0I=; b=I1+1N/Dm8U1P24P/nAN6GjBSdCYpKYDdA3JIW2bkW+MQmOEyxdKMQKSX/ONxODj6xDXNqF MUQEcndkCv3YBqCE+vgh3YvF+ous36b57aqDkgOR6i8E0FMUhU3YsKG99qXhNqtm+TDMs4 JJdxBDQ0PCAPBU8sbekq4372EqxWMCw= X-MC-Unique: RlWibRZkOHSeP-a1OrQWSQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 11/15] iotests: split linters.py out from 297 Date: Tue, 19 Oct 2021 10:49:14 -0400 Message-Id: <20211019144918.3159078-12-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634657340312100001 Content-Type: text/plain; charset="utf-8" Now, 297 is just the iotests-specific incantations and linters.py is as minimal as I can think to make it. The only remaining element in here that ought to be configuration and not code is the list of skip files, but they're still numerous enough that repeating them for mypy and pylint configurations both would be ... a hassle. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/297 | 72 +++++---------------------------- tests/qemu-iotests/linters.py | 76 +++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 61 deletions(-) create mode 100644 tests/qemu-iotests/linters.py diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index b7d9d6077b3..ee78a627359 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -17,74 +17,24 @@ # along with this program. If not, see . =20 import os -import re import subprocess import sys -from typing import List, Mapping, Optional +from typing import List =20 import iotests +import linters =20 =20 -# TODO: Empty this list! -SKIP_FILES =3D ( - '030', '040', '041', '044', '045', '055', '056', '057', '065', '093', - '096', '118', '124', '132', '136', '139', '147', '148', '149', - '151', '152', '155', '163', '165', '194', '196', '202', - '203', '205', '206', '207', '208', '210', '211', '212', '213', '216', - '218', '219', '224', '228', '234', '235', '236', '237', '238', - '240', '242', '245', '246', '248', '255', '256', '257', '258', '260', - '262', '264', '266', '274', '277', '280', '281', '295', '296', '298', - '299', '302', '303', '304', '307', - 'nbd-fault-injector.py', 'qcow2.py', 'qcow2_format.py', 'qed.py' -) - - -def is_python_file(filename): - if not os.path.isfile(filename): - return False - - if filename.endswith('.py'): - return True - - with open(filename, encoding=3D'utf-8') as f: - try: - first_line =3D f.readline() - return re.match('^#!.*python', first_line) is not None - except UnicodeDecodeError: # Ignore binary files - return False - - -def get_test_files() -> List[str]: - named_tests =3D [f'tests/{entry}' for entry in os.listdir('tests')] - check_tests =3D set(os.listdir('.') + named_tests) - set(SKIP_FILES) - return list(filter(is_python_file, check_tests)) - - -def run_linter( - tool: str, - args: List[str], - env: Optional[Mapping[str, str]] =3D None, - suppress_output: bool =3D False, -) -> None: - """ - Run a python-based linting tool. - - :param suppress_output: If True, suppress all stdout/stderr output. - :raise CalledProcessError: If the linter process exits with failure. - """ - subprocess.run( - ('python3', '-m', tool, *args), - env=3Denv, - check=3DTrue, - stdout=3Dsubprocess.PIPE if suppress_output else None, - stderr=3Dsubprocess.STDOUT if suppress_output else None, - universal_newlines=3DTrue, - ) +# Looking for something? +# +# List of files to exclude from linting: linters.py +# mypy configuration: mypy.ini +# pylint configuration: pylintrc =20 =20 def check_linter(linter: str) -> bool: try: - run_linter(linter, ['--version'], suppress_output=3DTrue) + linters.run_linter(linter, ['--version'], suppress_output=3DTrue) except subprocess.CalledProcessError: iotests.case_notrun(f"'{linter}' not found") return False @@ -98,7 +48,7 @@ def test_pylint(files: List[str]) -> None: if not check_linter('pylint'): return =20 - run_linter('pylint', files) + linters.run_linter('pylint', files) =20 =20 def test_mypy(files: List[str]) -> None: @@ -111,11 +61,11 @@ def test_mypy(files: List[str]) -> None: env =3D os.environ.copy() env['MYPYPATH'] =3D env['PYTHONPATH'] =20 - run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) + linters.run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) =20 =20 def main() -> None: - files =3D get_test_files() + files =3D linters.get_test_files() =20 iotests.logger.debug('Files to be checked:') iotests.logger.debug(', '.join(sorted(files))) diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py new file mode 100644 index 00000000000..c515c7afe36 --- /dev/null +++ b/tests/qemu-iotests/linters.py @@ -0,0 +1,76 @@ +# Copyright (C) 2020 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import os +import re +import subprocess +from typing import List, Mapping, Optional + + +# TODO: Empty this list! +SKIP_FILES =3D ( + '030', '040', '041', '044', '045', '055', '056', '057', '065', '093', + '096', '118', '124', '132', '136', '139', '147', '148', '149', + '151', '152', '155', '163', '165', '194', '196', '202', + '203', '205', '206', '207', '208', '210', '211', '212', '213', '216', + '218', '219', '224', '228', '234', '235', '236', '237', '238', + '240', '242', '245', '246', '248', '255', '256', '257', '258', '260', + '262', '264', '266', '274', '277', '280', '281', '295', '296', '298', + '299', '302', '303', '304', '307', + 'nbd-fault-injector.py', 'qcow2.py', 'qcow2_format.py', 'qed.py' +) + + +def is_python_file(filename): + if not os.path.isfile(filename): + return False + + if filename.endswith('.py'): + return True + + with open(filename, encoding=3D'utf-8') as f: + try: + first_line =3D f.readline() + return re.match('^#!.*python', first_line) is not None + except UnicodeDecodeError: # Ignore binary files + return False + + +def get_test_files() -> List[str]: + named_tests =3D [f'tests/{entry}' for entry in os.listdir('tests')] + check_tests =3D set(os.listdir('.') + named_tests) - set(SKIP_FILES) + return list(filter(is_python_file, check_tests)) + + +def run_linter( + tool: str, + args: List[str], + env: Optional[Mapping[str, str]] =3D None, + suppress_output: bool =3D False, +) -> None: + """ + Run a python-based linting tool. + + :param suppress_output: If True, suppress all stdout/stderr output. + :raise CalledProcessError: If the linter process exits with failure. + """ + subprocess.run( + ('python3', '-m', tool, *args), + env=3Denv, + check=3DTrue, + stdout=3Dsubprocess.PIPE if suppress_output else None, + stderr=3Dsubprocess.STDOUT if suppress_output else None, + universal_newlines=3DTrue, + ) --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634660317107623.4791825112987; Tue, 19 Oct 2021 09:18:37 -0700 (PDT) Received: from localhost ([::1]:44472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrox-0003em-UQ for importer@patchew.org; Tue, 19 Oct 2021 12:18:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqR2-0001vB-2W for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:56718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQy-0008HS-2C for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-VkFNGQaUOJaby4Ha-sxuKA-1; Tue, 19 Oct 2021 10:49:35 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 58AFC824FA7; Tue, 19 Oct 2021 14:49:34 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E19A5D6D7; Tue, 19 Oct 2021 14:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+kc4rw9PTg3j02DqJnesYJwK5eFavai1QX+gbLvRT1U=; b=G9rStVysvvg1FfdqYf6bZb+83UJmfss+Df1pQN0mPvG8rHej7Vssub1QLTd76lX5KgJo0f Z74lYrsoOEz60lix0HMsmUuZ5+iCFPrlid7GkiEGKx59GokJTtEoxhKag/lWJyToDg2ODJ wcpnVSplB2lAQE0ndO59AO9a4IHDYcY= X-MC-Unique: VkFNGQaUOJaby4Ha-sxuKA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 12/15] iotests/linters: Add entry point for linting via Python CI Date: Tue, 19 Oct 2021 10:49:15 -0400 Message-Id: <20211019144918.3159078-13-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=216.205.24.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660317437100001 Content-Type: text/plain; charset="utf-8" We need at least a tiny little shim here to join test file discovery with test invocation. This logic could conceivably be hosted somewhere in python/, but I felt it was strictly the least-rude thing to keep the test logic here in iotests/, even if this small function isn't itself an iotest. Note that we don't actually even need the executable bit here, we'll be relying on the ability to run this module as a script using Python CLI arguments. No chance it gets misunderstood as an actual iotest that way. (It's named, not in tests/, doesn't have the execute bit, and doesn't have an execution shebang.) Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/linters.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py index c515c7afe36..46c28fdcda0 100644 --- a/tests/qemu-iotests/linters.py +++ b/tests/qemu-iotests/linters.py @@ -16,6 +16,7 @@ import os import re import subprocess +import sys from typing import List, Mapping, Optional =20 =20 @@ -74,3 +75,29 @@ def run_linter( stderr=3Dsubprocess.STDOUT if suppress_output else None, universal_newlines=3DTrue, ) + + +def main() -> None: + """ + Used by the Python CI system as an entry point to run these linters. + """ + def show_usage() -> None: + print(f"Usage: {sys.argv[0]} < --mypy | --pylint >", file=3Dsys.st= derr) + sys.exit(1) + + if len(sys.argv) !=3D 2: + show_usage() + + files =3D get_test_files() + + if sys.argv[1] =3D=3D '--pylint': + run_linter('pylint', files) + elif sys.argv[1] =3D=3D '--mypy': + run_linter('mypy', files) + else: + print(f"Unrecognized argument: '{sys.argv[1]}'", file=3Dsys.stderr) + show_usage() + + +if __name__ =3D=3D '__main__': + main() --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634660536598534.0975383228648; Tue, 19 Oct 2021 09:22:16 -0700 (PDT) Received: from localhost ([::1]:52952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrsV-0000ng-FB for importer@patchew.org; Tue, 19 Oct 2021 12:22:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqR2-0001v1-0N for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:21238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQu-0008Es-LB for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-103-o8A35AadMkujJmFdo-89Yw-1; Tue, 19 Oct 2021 10:49:36 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 70F85802682; Tue, 19 Oct 2021 14:49:35 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F8825D6D7; Tue, 19 Oct 2021 14:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654979; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=of0nRlCXnCXhgd1yWv9n6B/plzG43d0f0S9OjxqVBbE=; b=AGeexfLe/JybFEz5N4m6BO1rZzzDAoNesXXRfDu6x1kJab6BKCJB6zKKpZi6bNCQ4AXcwU Nao+kSQv4HSjrxAgqon7lySucQh6pY8XtPT3Zr4fUJGmefct3Sop/3wmtwQ2KZZKN0BIj9 XTWXeVgxqMfBkBq5YIumIAIuRos18bQ= X-MC-Unique: o8A35AadMkujJmFdo-89Yw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 13/15] iotests/linters: Add workaround for mypy bug #9852 Date: Tue, 19 Oct 2021 10:49:16 -0400 Message-Id: <20211019144918.3159078-14-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634660538651100001 Content-Type: text/plain; charset="utf-8" This one is insidious: if you write an import as "from {namespace} import {subpackage}" as mirror-top-perms (now) does, mypy will fail on every-other invocation *if* the package being imported is a typed, installed, namespace-scoped package. Upsettingly, that's exactly what 'qemu.[aqmp|qmp|machine]' et al are in the context of Python CI tests. Now, I could just edit mirror-top-perms to avoid this invocation, but since I tripped on a landmine, I might as well head it off at the pass and make sure nobody else trips on that same landmine. It seems to have something to do with the order in which files are checked as well, meaning the random order in which set(os.listdir()) produces the list of files to test will cause problems intermittently and not just strictly "every other run". This will be fixed in mypy >=3D 0.920, which is not released yet. The workaround for now is to disable incremental checking, which avoids the issue. Note: This workaround is not applied when running iotest 297 directly, because the bug does not surface there! Given the nature of CI jobs not starting with any stale cache to begin with, this really only has a half-second impact on manual runs of the Python test suite when executed directly by a developer on their local machine. The workaround may be removed when the Python package requirements can stipulate mypy 0.920 or higher, which can happen as soon as it is released. (Barring any unforseen compatibility issues that 0.920 may bring with it.) See also: https://github.com/python/mypy/issues/11010 https://github.com/python/mypy/issues/9852 Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- tests/qemu-iotests/linters.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py index 46c28fdcda0..65c4c4e8272 100644 --- a/tests/qemu-iotests/linters.py +++ b/tests/qemu-iotests/linters.py @@ -93,7 +93,9 @@ def show_usage() -> None: if sys.argv[1] =3D=3D '--pylint': run_linter('pylint', files) elif sys.argv[1] =3D=3D '--mypy': - run_linter('mypy', files) + # mypy bug #9852; disable incremental checking as a workaround. + args =3D ['--no-incremental'] + files + run_linter('mypy', args) else: print(f"Unrecognized argument: '{sys.argv[1]}'", file=3Dsys.stderr) show_usage() --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163465869725317.310654756170266; Tue, 19 Oct 2021 08:51:37 -0700 (PDT) Received: from localhost ([::1]:54300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcrOq-00036c-6x for importer@patchew.org; Tue, 19 Oct 2021 11:51:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44940) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqR1-0001uJ-29 for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37558) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQv-0008Fl-7l for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:46 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-600-OueSyCSuNxemkNWylfnrmQ-1; Tue, 19 Oct 2021 10:49:37 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8E32D801FCE; Tue, 19 Oct 2021 14:49:36 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BE9E5D6D7; Tue, 19 Oct 2021 14:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654980; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0rnYm3KUMFTKZkdzVIR4h2DoAnLK6JzNtjjg3NWdm2Y=; b=KFi4cSlFH0qAJyA+rjlHDOGHeSLuIBaFFzdmKUNYrYXgHpCOHJ9BESM6IJkgygmHh1m3BW PUCL9MgIed4NPCLJcz8pBk7nnWsUob3jc5gNaLH4IKaab8jai82zUJZPXiuN96E7lAdY6o vsYuzVb1kDCqKaw7HJUaBY7FI++ngAg= X-MC-Unique: OueSyCSuNxemkNWylfnrmQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 14/15] python: Add iotest linters to test suite Date: Tue, 19 Oct 2021 10:49:17 -0400 Message-Id: <20211019144918.3159078-15-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634658699126100001 Content-Type: text/plain; charset="utf-8" Run mypy and pylint on the iotests files directly from the Python CI test infrastructure. This ensures that any accidental breakages to the qemu.[qmp|aqmp|machine|utils] packages will be caught by that test suite. It also ensures that these linters are run with well-known versions and test against a wide variety of python versions, which helps to find accidental cross-version python compatibility issues. Signed-off-by: John Snow Reviewed-by: Hanna Reitz --- python/tests/iotests-mypy.sh | 4 ++++ python/tests/iotests-pylint.sh | 4 ++++ 2 files changed, 8 insertions(+) create mode 100755 python/tests/iotests-mypy.sh create mode 100755 python/tests/iotests-pylint.sh diff --git a/python/tests/iotests-mypy.sh b/python/tests/iotests-mypy.sh new file mode 100755 index 00000000000..ee764708199 --- /dev/null +++ b/python/tests/iotests-mypy.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e + +cd ../tests/qemu-iotests/ +python3 -m linters --mypy diff --git a/python/tests/iotests-pylint.sh b/python/tests/iotests-pylint.sh new file mode 100755 index 00000000000..4cae03424b4 --- /dev/null +++ b/python/tests/iotests-pylint.sh @@ -0,0 +1,4 @@ +#!/bin/sh -e + +cd ../tests/qemu-iotests/ +python3 -m linters --pylint --=20 2.31.1 From nobody Sat Apr 27 07:11:41 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1634657499797605.7035212323468; Tue, 19 Oct 2021 08:31:39 -0700 (PDT) Received: from localhost ([::1]:39126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mcr5W-0007Wu-00 for importer@patchew.org; Tue, 19 Oct 2021 11:31:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqR2-0001wZ-UY for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58972) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mcqQy-0008HN-2U for qemu-devel@nongnu.org; Tue, 19 Oct 2021 10:49:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-48-fKkFN0DpNgyGQN4g9X1qzA-1; Tue, 19 Oct 2021 10:49:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B67EB1966321; Tue, 19 Oct 2021 14:49:37 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.11.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id C29E262A41; Tue, 19 Oct 2021 14:49:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lumV0/BwsSQ54/O+yF70T3WvYgzrmN6eHP2QFSr4Zbs=; b=PbBwxOii2U7mJjnNrvvucbA/5UaT5jSkyYkQ4k3SFnH03QNIy6+gdXtOvjxNM7S62E4OSt 3qDZI0NzVx4dAmses5WRKrhTw8bWjLoGKwzgMILFcn4TqPEwkwVotPhPx+AlXVHOX8w04F ACJWShlvfSjZyaiMlCuVVnIR7WyDa88= X-MC-Unique: fKkFN0DpNgyGQN4g9X1qzA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 15/15] iotests: [RFC] drop iotest 297 Date: Tue, 19 Oct 2021 10:49:18 -0400 Message-Id: <20211019144918.3159078-16-jsnow@redhat.com> In-Reply-To: <20211019144918.3159078-1-jsnow@redhat.com> References: <20211019144918.3159078-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jsnow@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Eduardo Habkost , qemu-block@nongnu.org, Hanna Reitz , Cleber Rosa , John Snow Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1634657502333100002 Content-Type: text/plain; charset="utf-8" (This is highlighting a what-if, which might make it clear why any special infrastructure is still required at all. It's not intended to actually be merged at this step -- running JUST the iotest linters from e.g. 'make check' is not yet accommodated, so there's no suitable replacement for 297 for block test authors.) Drop 297. As a consequence, we no longer need to pass an environment variable to the mypy/pylint invocations, so that can be dropped. We also now no longer need to hide output-except-on-error, so that can be dropped as well. The only thing that necessitates any special running logic anymore is the skip list and the python-test-detection code. Without those, we could easily codify the tests as simply: [pylint|mypy] *.py tests/*.py ... and drop this entire file. We're not quite there yet, though. Signed-off-by: John Snow --- tests/qemu-iotests/297 | 82 ----------------------------------- tests/qemu-iotests/297.out | 2 - tests/qemu-iotests/linters.py | 14 +----- 3 files changed, 2 insertions(+), 96 deletions(-) delete mode 100755 tests/qemu-iotests/297 delete mode 100644 tests/qemu-iotests/297.out diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 deleted file mode 100755 index ee78a627359..00000000000 --- a/tests/qemu-iotests/297 +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python3 -# group: meta -# -# Copyright (C) 2020 Red Hat, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import os -import subprocess -import sys -from typing import List - -import iotests -import linters - - -# Looking for something? -# -# List of files to exclude from linting: linters.py -# mypy configuration: mypy.ini -# pylint configuration: pylintrc - - -def check_linter(linter: str) -> bool: - try: - linters.run_linter(linter, ['--version'], suppress_output=3DTrue) - except subprocess.CalledProcessError: - iotests.case_notrun(f"'{linter}' not found") - return False - return True - - -def test_pylint(files: List[str]) -> None: - print('=3D=3D=3D pylint =3D=3D=3D') - sys.stdout.flush() - - if not check_linter('pylint'): - return - - linters.run_linter('pylint', files) - - -def test_mypy(files: List[str]) -> None: - print('=3D=3D=3D mypy =3D=3D=3D') - sys.stdout.flush() - - if not check_linter('mypy'): - return - - env =3D os.environ.copy() - env['MYPYPATH'] =3D env['PYTHONPATH'] - - linters.run_linter('mypy', files, env=3Denv, suppress_output=3DTrue) - - -def main() -> None: - files =3D linters.get_test_files() - - iotests.logger.debug('Files to be checked:') - iotests.logger.debug(', '.join(sorted(files))) - - for test in (test_pylint, test_mypy): - try: - test(files) - except subprocess.CalledProcessError as exc: - # Linter failure will be caught by diffing the IO. - if exc.output: - print(exc.output) - - -iotests.script_main(main) diff --git a/tests/qemu-iotests/297.out b/tests/qemu-iotests/297.out deleted file mode 100644 index f2e1314d104..00000000000 --- a/tests/qemu-iotests/297.out +++ /dev/null @@ -1,2 +0,0 @@ -=3D=3D=3D pylint =3D=3D=3D -=3D=3D=3D mypy =3D=3D=3D diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py index 65c4c4e8272..486b7125c1d 100644 --- a/tests/qemu-iotests/linters.py +++ b/tests/qemu-iotests/linters.py @@ -17,7 +17,7 @@ import re import subprocess import sys -from typing import List, Mapping, Optional +from typing import List =20 =20 # TODO: Empty this list! @@ -55,25 +55,15 @@ def get_test_files() -> List[str]: return list(filter(is_python_file, check_tests)) =20 =20 -def run_linter( - tool: str, - args: List[str], - env: Optional[Mapping[str, str]] =3D None, - suppress_output: bool =3D False, -) -> None: +def run_linter(tool: str, args: List[str]) -> None: """ Run a python-based linting tool. =20 - :param suppress_output: If True, suppress all stdout/stderr output. :raise CalledProcessError: If the linter process exits with failure. """ subprocess.run( ('python3', '-m', tool, *args), - env=3Denv, check=3DTrue, - stdout=3Dsubprocess.PIPE if suppress_output else None, - stderr=3Dsubprocess.STDOUT if suppress_output else None, - universal_newlines=3DTrue, ) =20 =20 --=20 2.31.1