From nobody Sun Feb 8 21:33:20 2026 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 1632356334274859.2608165602335; Wed, 22 Sep 2021 17:18:54 -0700 (PDT) Received: from localhost ([::1]:54138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCRw-0004Vb-4g for importer@patchew.org; Wed, 22 Sep 2021 20:18:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51482) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPn-0001dp-1p for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPh-0000tY-Hx for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16: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-556-P7-h2pl8OTeOldpU1UjH3A-1; Wed, 22 Sep 2021 20:16:30 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 743E4835DE3; Thu, 23 Sep 2021 00:16:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id F30B710023AB; Thu, 23 Sep 2021 00:16:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356192; 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=09yd4UBzkttV1nDsSh++TA/2xfvjsfL1hvTmlU2J4Zs=; b=B6HHsDRtBbpHXVOJmeJbOVuTX1cPR1L54IysNDSwLpk8bodjtzPGJ8DLrZxosshHPnxK6U ixhQTuwmVWiqxFG0b3JKBH0vhCn4st9fNkbpEhoA3C6ppfJwUrF6CB5NW4cZGbKUGE/0LU BhLJ2RkN52x9FVhKb8HYEjpwODBC2Yc= X-MC-Unique: P7-h2pl8OTeOldpU1UjH3A-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 1/6] iotests: add 'qemu' package location to PYTHONPATH in testenv Date: Wed, 22 Sep 2021 20:16:20 -0400 Message-Id: <20210923001625.3996451-2-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , qemu-block@nongnu.org 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: 1632356334844100003 Content-Type: text/plain; charset="utf-8" We can drop the sys.path hacking in various places by doing this. Additionally, by doing it in one place right up top, we can print interesting warnings in case the environment does not look correct. If we ever decide to change how the environment is crafted, all of the "help me find my python packages" goop is all in one place, right in one function. Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/235 | 2 -- tests/qemu-iotests/297 | 6 ------ tests/qemu-iotests/300 | 7 +++---- tests/qemu-iotests/iotests.py | 2 -- tests/qemu-iotests/testenv.py | 14 +++++++++----- tests/qemu-iotests/tests/mirror-top-perms | 7 +++---- 6 files changed, 15 insertions(+), 23 deletions(-) diff --git a/tests/qemu-iotests/235 b/tests/qemu-iotests/235 index 8aed45f9a76..4de920c3801 100755 --- a/tests/qemu-iotests/235 +++ b/tests/qemu-iotests/235 @@ -24,8 +24,6 @@ import os import iotests from iotests import qemu_img_create, qemu_io, file_path, log =20 -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) - from qemu.machine import QEMUMachine =20 iotests.script_initialize(supported_fmts=3D['qcow2']) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index b04cba53667..467b712280e 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -68,12 +68,6 @@ def run_linters(): # Todo notes are fine, but fixme's or xxx's should probably just be # fixed (in tests, at least) env =3D os.environ.copy() - qemu_module_path =3D os.path.join(os.path.dirname(__file__), - '..', '..', 'python') - try: - env['PYTHONPATH'] +=3D os.pathsep + qemu_module_path - except KeyError: - env['PYTHONPATH'] =3D qemu_module_path subprocess.run(('pylint-3', '--score=3Dn', '--notes=3DFIXME,XXX', *fil= es), env=3Denv, check=3DFalse) =20 diff --git a/tests/qemu-iotests/300 b/tests/qemu-iotests/300 index fe94de84edd..10f9f2a8da6 100755 --- a/tests/qemu-iotests/300 +++ b/tests/qemu-iotests/300 @@ -24,12 +24,11 @@ import random import re from typing import Dict, List, Optional =20 -import iotests - -# Import qemu after iotests.py has amended sys.path -# pylint: disable=3Dwrong-import-order from qemu.machine import machine =20 +import iotests + + BlockBitmapMapping =3D List[Dict[str, object]] =20 mig_sock =3D os.path.join(iotests.sock_dir, 'mig_sock') diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index ce06cf56304..b06ad76e0c5 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -36,8 +36,6 @@ =20 from contextlib import contextmanager =20 -# pylint: disable=3Dimport-error, wrong-import-position -sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'pytho= n')) from qemu.machine import qtest from qemu.qmp import QMPMessage =20 diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 70da0d60c80..88104dace90 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -108,12 +108,16 @@ def init_directories(self) -> None: SAMPLE_IMG_DIR OUTPUT_DIR """ + + # Path where qemu goodies live in this source tree. + qemu_srctree_path =3D Path(__file__, '../../../python').resolve() + self.pythonpath =3D os.getenv('PYTHONPATH') - if self.pythonpath: - self.pythonpath =3D self.source_iotests + os.pathsep + \ - self.pythonpath - else: - self.pythonpath =3D self.source_iotests + self.pythonpath =3D os.pathsep.join(filter(None, ( + self.source_iotests, + str(qemu_srctree_path), + self.pythonpath, + ))) =20 self.test_dir =3D os.getenv('TEST_DIR', os.path.join(os.getcwd(), 'scratch')) diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests= /tests/mirror-top-perms index 2fc8dd66e0a..73138a0ef91 100755 --- a/tests/qemu-iotests/tests/mirror-top-perms +++ b/tests/qemu-iotests/tests/mirror-top-perms @@ -20,13 +20,12 @@ # =20 import os + +import qemu + import iotests from iotests import qemu_img =20 -# Import qemu after iotests.py has amended sys.path -# pylint: disable=3Dwrong-import-order -import qemu - =20 image_size =3D 1 * 1024 * 1024 source =3D os.path.join(iotests.test_dir, 'source.img') --=20 2.31.1 From nobody Sun Feb 8 21:33:20 2026 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 1632356339469441.36140788653756; Wed, 22 Sep 2021 17:18:59 -0700 (PDT) Received: from localhost ([::1]:54704 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCS1-0004td-3P for importer@patchew.org; Wed, 22 Sep 2021 20:18:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPn-0001dw-2F for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:47229) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPk-0000v6-Ot for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16: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-582-oyQETdoZN_q84-BEnPTEgw-1; Wed, 22 Sep 2021 20:16:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08ED61084683; Thu, 23 Sep 2021 00:16:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90B4610023AB; Thu, 23 Sep 2021 00:16:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356194; 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=sNYoL41WoJVIOd7s72GSXkG7SUCqEjVatxXCDP+ruck=; b=cxBsQX9pC8vfSqfXMgxW+FyNEVGUgJ0bJi/7hVVutI7OUdEWA234h2qqMwibe5G6WgLybn l0SJLW84PYgZqXVgyw7WR4qVfU8B5Zo272pfK+JIoxAHWlFJffj1CFCa2SxoX5Vm1IWd1A Ze4vc+iQz5RpIlrNQJyMfUfHkKdX7pw= X-MC-Unique: oyQETdoZN_q84-BEnPTEgw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 2/6] iotests: add warning for rogue 'qemu' packages Date: Wed, 22 Sep 2021 20:16:21 -0400 Message-Id: <20210923001625.3996451-3-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , qemu-block@nongnu.org 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: 1632356341164100001 Content-Type: text/plain; charset="utf-8" Add a warning for when 'iotests' runs against a qemu namespace that isn't the one in the source tree. This might occur if you have (accidentally) installed the Python namespace package to your local packages. (I'm not going to say that this is because I bit myself with this, but. You can fill in the blanks.) Signed-off-by: John Snow --- tests/qemu-iotests/testenv.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 88104dace90..8a43b193af5 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -16,6 +16,8 @@ # along with this program. If not, see . # =20 +import importlib.util +import logging import os import sys import tempfile @@ -25,7 +27,7 @@ import random import subprocess import glob -from typing import List, Dict, Any, Optional, ContextManager +from typing import List, Dict, Any, Optional, ContextManager, cast =20 DEF_GDB_OPTIONS =3D 'localhost:12345' =20 @@ -112,6 +114,22 @@ def init_directories(self) -> None: # Path where qemu goodies live in this source tree. qemu_srctree_path =3D Path(__file__, '../../../python').resolve() =20 + # warn if we happen to be able to find 'qemu' packages from an + # unexpected location (i.e. the package is already installed in + # the user's environment) + qemu_spec =3D importlib.util.find_spec('qemu.qmp') + if qemu_spec: + spec_path =3D Path(cast(str, qemu_spec.origin)) + try: + _ =3D spec_path.relative_to(qemu_srctree_path) + except ValueError: + self._logger.warning( + "WARNING: 'qemu' package will be imported from outside= " + "the source tree!") + self._logger.warning( + "Importing from: '%s'", + spec_path.parents[1]) + self.pythonpath =3D os.getenv('PYTHONPATH') self.pythonpath =3D os.pathsep.join(filter(None, ( self.source_iotests, @@ -231,6 +249,7 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode:= str, =20 self.build_root =3D os.path.join(self.build_iotests, '..', '..') =20 + self._logger =3D logging.getLogger('qemu.iotests') self.init_directories() self.init_binaries() =20 --=20 2.31.1 From nobody Sun Feb 8 21:33:20 2026 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 1632356470641771.950373522474; Wed, 22 Sep 2021 17:21:10 -0700 (PDT) Received: from localhost ([::1]:60608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCU9-0000W9-Lt for importer@patchew.org; Wed, 22 Sep 2021 20:21:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPq-0001ez-FO for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPk-0000vG-PL for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:40 -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-gkOi6lD2M86mcfTsnetU9Q-1; Wed, 22 Sep 2021 20:16:33 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF9D8362FA; Thu, 23 Sep 2021 00:16:32 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F7F910023AB; Thu, 23 Sep 2021 00:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356195; 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=qciHK1mWa+3ySCh7W+i8z1zYj9PFBUTXrSscYS25leY=; b=HD6cKgXHcZ5lWyvEoCy8TZoI0hwGHXq9i+MamgVekJ9++/qWcDXO04hZW6s7fTqwwfZHVg yDMDtNLHwKa7a4oELAd7rVr431JKS9C2o/nsf3P8eafu0AF42jiprAgkXJpzT/Br0N8NFG SQxwt1N6xxsNeZlHwYNLrAsGIOEyrl4= X-MC-Unique: gkOi6lD2M86mcfTsnetU9Q-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 3/6] iotests/linters: check mypy files all at once Date: Wed, 22 Sep 2021 20:16:22 -0400 Message-Id: <20210923001625.3996451-4-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , qemu-block@nongnu.org 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: 1632356472650100001 Content-Type: text/plain; charset="utf-8" We can circumvent the '__main__' redefinition problem by passing --scripts-are-modules. Take mypy out of the loop per-filename and check everything in one go: it's quite a bit faster. Signed-off-by: John Snow Reviewed-by: Hanna Reitz Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/297 | 44 +++++++++++++++++++----------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/tests/qemu-iotests/297 b/tests/qemu-iotests/297 index 467b712280e..91ec34d9521 100755 --- a/tests/qemu-iotests/297 +++ b/tests/qemu-iotests/297 @@ -74,32 +74,28 @@ def run_linters(): print('=3D=3D=3D mypy =3D=3D=3D') sys.stdout.flush() =20 - # We have to call mypy separately for each file. Otherwise, it - # will interpret all given files as belonging together (i.e., they - # may not both define the same classes, etc.; most notably, they - # must not both define the __main__ module). env['MYPYPATH'] =3D env['PYTHONPATH'] - for filename in files: - 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', - filename), - env=3Denv, - check=3DFalse, - stdout=3Dsubprocess.PIPE, - stderr=3Dsubprocess.STDOUT, - universal_newlines=3DTrue) + 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), + env=3Denv, + check=3DFalse, + stdout=3Dsubprocess.PIPE, + stderr=3Dsubprocess.STDOUT, + universal_newlines=3DTrue) =20 - if p.returncode !=3D 0: - print(p.stdout) + if p.returncode !=3D 0: + print(p.stdout) =20 =20 for linter in ('pylint-3', 'mypy'): --=20 2.31.1 From nobody Sun Feb 8 21:33:20 2026 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 1632356350344533.833114186049; Wed, 22 Sep 2021 17:19:10 -0700 (PDT) Received: from localhost ([::1]:55296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCSC-0005HW-5P for importer@patchew.org; Wed, 22 Sep 2021 20:19:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPn-0001e0-Rg for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58105) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPl-0000vu-4D for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:39 -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-28-j5UDWuaJPoms1ACandYZQA-1; Wed, 22 Sep 2021 20:16:35 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CE2F802921; Thu, 23 Sep 2021 00:16:34 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0B76710023AB; Thu, 23 Sep 2021 00:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356196; 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=CgzOlYuQ2C4BKVmMAal1eWQcAlSTvPVlEid5eTvaag8=; b=X8nfrN6EFiJ/VH9V1fchdHV6ag4o+2ynfAsDzEYwYs9b8MEneszu0hFg1ggAjWI/cnbzfN N/MKkVnd5YzxiNguZu2WbAcgki93peza6kovDetzVPiMF3aqB6j+VYRBZggyYdW8Ps8mjO orUSPbNRNcPN8rQxzS5irjk7PZpcEGA= X-MC-Unique: j5UDWuaJPoms1ACandYZQA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 4/6] iotests/mirror-top-perms: Adjust imports Date: Wed, 22 Sep 2021 20:16:23 -0400 Message-Id: <20210923001625.3996451-5-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.133.124; envelope-from=jsnow@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , qemu-block@nongnu.org, John Snow , Hanna Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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: 1632356351733100001 We need to import things from the qemu namespace; importing the namespace alone doesn't bring the submodules with it -- unless someone else (like iotests.py) imports them too. Adjust the imports. Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Hanna Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/mirror-top-perms | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/qemu-iotests/tests/mirror-top-perms b/tests/qemu-iotests= /tests/mirror-top-perms index 73138a0ef91..3d475aa3a54 100755 --- a/tests/qemu-iotests/tests/mirror-top-perms +++ b/tests/qemu-iotests/tests/mirror-top-perms @@ -21,7 +21,8 @@ =20 import os =20 -import qemu +from qemu import qmp +from qemu.machine import machine =20 import iotests from iotests import qemu_img @@ -46,7 +47,7 @@ class TestMirrorTopPerms(iotests.QMPTestCase): def tearDown(self): try: self.vm.shutdown() - except qemu.machine.machine.AbnormalShutdown: + except machine.AbnormalShutdown: pass =20 if self.vm_b is not None: @@ -101,7 +102,7 @@ class TestMirrorTopPerms(iotests.QMPTestCase): self.vm_b.launch() print('ERROR: VM B launched successfully, this should not have= ' 'happened') - except qemu.qmp.QMPConnectError: + except qmp.QMPConnectError: assert 'Is another process using the image' in self.vm_b.get_l= og() =20 result =3D self.vm.qmp('block-job-cancel', --=20 2.31.1 From nobody Sun Feb 8 21:33:20 2026 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 163235656455134.932683300726694; Wed, 22 Sep 2021 17:22:44 -0700 (PDT) Received: from localhost ([::1]:34520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCVf-00023L-IM for importer@patchew.org; Wed, 22 Sep 2021 20:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPq-0001f3-H2 for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32749) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPn-0000y9-LI for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:42 -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-563-q8w4dYvCMMKgjjLEFsrlew-1; Wed, 22 Sep 2021 20:16:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D990D1808306; Thu, 23 Sep 2021 00:16:35 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5A5D10023AB; Thu, 23 Sep 2021 00:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356198; 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=TwEaOgFJ6mGKGW3hDP9CjHHnJdlXb6kzgxy3oyVHq5k=; b=UmpXO2RhCjoUDnfdt4BpQrSM6O2XnQ4nWvV4QWON44gbSKnBV/x6Vmgi9Ev4zP8LjQXO6N KENd5K76HmleuMQRh3azLeV57LwY/ClTVFrw9r4FXyAZ3PE1jDfVjy2/V7TLqO//6YEpPx 1JtViVIodrrWeBhcCicaXyHAeAfJjlc= X-MC-Unique: q8w4dYvCMMKgjjLEFsrlew-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 5/6] iotests/migrate-bitmaps-test: delint Date: Wed, 22 Sep 2021 20:16:24 -0400 Message-Id: <20210923001625.3996451-6-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , qemu-block@nongnu.org, John Snow , Hanna Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= 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: 1632356565973100001 Mostly uninteresting stuff. Move the test injections under a function named main() so that the variables used during that process aren't in the global scope. Signed-off-by: John Snow Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Hanna Reitz Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/migrate-bitmaps-test | 50 +++++++++++-------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/tests/qemu-iotests/tests/migrate-bitmaps-test b/tests/qemu-iot= ests/tests/migrate-bitmaps-test index dc431c35b35..c23df3d75c7 100755 --- a/tests/qemu-iotests/tests/migrate-bitmaps-test +++ b/tests/qemu-iotests/tests/migrate-bitmaps-test @@ -19,10 +19,11 @@ # along with this program. If not, see . # =20 -import os import itertools import operator +import os import re + import iotests from iotests import qemu_img, qemu_img_create, Timeout =20 @@ -224,25 +225,6 @@ def inject_test_case(klass, suffix, method, *args, **k= wargs): setattr(klass, 'test_' + method + suffix, lambda self: mc(self)) =20 =20 -for cmb in list(itertools.product((True, False), repeat=3D5)): - name =3D ('_' if cmb[0] else '_not_') + 'persistent_' - name +=3D ('_' if cmb[1] else '_not_') + 'migbitmap_' - name +=3D '_online' if cmb[2] else '_offline' - name +=3D '_shared' if cmb[3] else '_nonshared' - if cmb[4]: - name +=3D '__pre_shutdown' - - inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration', - *list(cmb)) - -for cmb in list(itertools.product((True, False), repeat=3D2)): - name =3D ('_' if cmb[0] else '_not_') + 'persistent_' - name +=3D ('_' if cmb[1] else '_not_') + 'migbitmap' - - inject_test_case(TestDirtyBitmapMigration, name, - 'do_test_migration_resume_source', *list(cmb)) - - class TestDirtyBitmapBackingMigration(iotests.QMPTestCase): def setUp(self): qemu_img_create('-f', iotests.imgfmt, base_a, size) @@ -304,6 +286,30 @@ class TestDirtyBitmapBackingMigration(iotests.QMPTestC= ase): self.assert_qmp(result, 'return', {}) =20 =20 +def main() -> None: + for cmb in list(itertools.product((True, False), repeat=3D5)): + name =3D ('_' if cmb[0] else '_not_') + 'persistent_' + name +=3D ('_' if cmb[1] else '_not_') + 'migbitmap_' + name +=3D '_online' if cmb[2] else '_offline' + name +=3D '_shared' if cmb[3] else '_nonshared' + if cmb[4]: + name +=3D '__pre_shutdown' + + inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migratio= n', + *list(cmb)) + + for cmb in list(itertools.product((True, False), repeat=3D2)): + name =3D ('_' if cmb[0] else '_not_') + 'persistent_' + name +=3D ('_' if cmb[1] else '_not_') + 'migbitmap' + + inject_test_case(TestDirtyBitmapMigration, name, + 'do_test_migration_resume_source', *list(cmb)) + + iotests.main( + supported_fmts=3D['qcow2'], + supported_protocols=3D['file'] + ) + + if __name__ =3D=3D '__main__': - iotests.main(supported_fmts=3D['qcow2'], - supported_protocols=3D['file']) + main() --=20 2.31.1 From nobody Sun Feb 8 21:33:20 2026 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 1632356639795502.9442351673224; Wed, 22 Sep 2021 17:23:59 -0700 (PDT) Received: from localhost ([::1]:36848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTCWs-0003wR-Bv for importer@patchew.org; Wed, 22 Sep 2021 20:23:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPr-0001fr-3L for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31927) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTCPn-0000yL-M3 for qemu-devel@nongnu.org; Wed, 22 Sep 2021 20:16:42 -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-480-0CaBL7XbMUeqEmONEa3QJQ-1; Wed, 22 Sep 2021 20:16:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE4E31084683; Thu, 23 Sep 2021 00:16:36 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0ED0C10023AB; Thu, 23 Sep 2021 00:16:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632356199; 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=iNj5lBvqK98wFV/T6evKJ8hd9rkKBxhaDQ0OU1OkuHU=; b=HyiZdgeaXiMM1ra2J8Wsy5IbJa1Ev66tYlJcx0148mYsS0Ft/S0cHur0MVtOPsdYLWUgOg O/CNOGgj+S12bq6U8bQY8ucgQUp2XVd8p5Fse9KehCy85ZjX7oqJXK1mv+bDxvC5D5d5U7 j4JY4UgAGHAEkYyA57kxJQ4tJ6Z5zCo= X-MC-Unique: 0CaBL7XbMUeqEmONEa3QJQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH 6/6] iotests: Update for pylint 2.11.1 Date: Wed, 22 Sep 2021 20:16:25 -0400 Message-Id: <20210923001625.3996451-7-jsnow@redhat.com> In-Reply-To: <20210923001625.3996451-1-jsnow@redhat.com> References: <20210923001625.3996451-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1.472, 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 , Hanna Reitz , Vladimir Sementsov-Ogievskiy , John Snow , qemu-block@nongnu.org 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: 1632356641041100001 Content-Type: text/plain; charset="utf-8" 1. Ignore the new f-strings warning, we're not interested in doing a full conversion at this time. 2. Just mute the unbalanced-tuple-unpacking warning, it's not a real error in this case and muting the dozens of callsites is just not worth it. 3. Add encodings to read_text(). Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/pylintrc | 6 +++++- tests/qemu-iotests/testrunner.py | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc index f2c0b522ac0..8cb4e1d6a6d 100644 --- a/tests/qemu-iotests/pylintrc +++ b/tests/qemu-iotests/pylintrc @@ -19,13 +19,17 @@ disable=3Dinvalid-name, too-many-public-methods, # pylint warns about Optional[] etc. as unsubscriptable in 3.9 unsubscriptable-object, + # pylint's static analysis causes false positivies for file_path(); + # If we really care to make it statically knowable, we'll use mypy. + unbalanced-tuple-unpacking, # Sometimes we need to disable a newly introduced pylint warning. # Doing so should not produce a warning in older versions of pylin= t. bad-option-value, # These are temporary, and should be removed: missing-docstring, too-many-return-statements, - too-many-statements + too-many-statements, + consider-using-f-string, =20 [FORMAT] =20 diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunn= er.py index 4a6ec421ed6..a56b6da3968 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -266,12 +266,13 @@ def do_run_test(self, test: str) -> TestResult: diff=3Dfile_diff(str(f_reference), str(f_bad= ))) =20 if f_notrun.exists(): - return TestResult(status=3D'not run', - description=3Df_notrun.read_text().strip()) + return TestResult( + status=3D'not run', + description=3Df_notrun.read_text(encoding=3D'utf-8').strip= ()) =20 casenotrun =3D '' if f_casenotrun.exists(): - casenotrun =3D f_casenotrun.read_text() + casenotrun =3D f_casenotrun.read_text(encoding=3D'utf-8') =20 diff =3D file_diff(str(f_reference), str(f_bad)) if diff: --=20 2.31.1