From nobody Fri May 17 10:13:23 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 1632420879329616.6135741538417; Thu, 23 Sep 2021 11:14:39 -0700 (PDT) Received: from localhost ([::1]:51866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTEz-0005yM-VN for importer@patchew.org; Thu, 23 Sep 2021 14:14:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8J-0005Q4-Ky for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29149) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT89-0003Un-ES for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07: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-560-ATqZj1YDOXettLNuJJTLrw-1; Thu, 23 Sep 2021 14:07:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1ACF61084683; Thu, 23 Sep 2021 18:07:26 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id F14A060BE5; Thu, 23 Sep 2021 18:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420450; 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=SZ4cC/7v/qxYlGzLlH72C5MQYwtyyCkS4n6qF7epGOk=; b=JtWxMxLEjVrlO7L6EDnZZS8SpUgsr+TCu3mJo0ZgwTNOKdN5AJIFgQMrM9UaRw/vpY3XNu JQi88Vc9jyk9gaGthloQbR9puKABsp3+tphQrXh1FGLeaxFtYkq8PqRwWiCAq6sGTCIEo+ MTOb+E0NbDq6QybaDaZuVpnbxENf+mk= X-MC-Unique: ATqZj1YDOXettLNuJJTLrw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 1/6] iotests: add 'qemu' package location to PYTHONPATH in testenv Date: Thu, 23 Sep 2021 14:07:10 -0400 Message-Id: <20210923180715.4168522-2-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.473, 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 , Vladimir Sementsov-Ogievskiy , Daniel Berrange , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , 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: 1632420880226100001 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. (See next commit.) 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 Reviewed-by: Kevin Wolf --- 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 | 15 +++++++++------ tests/qemu-iotests/tests/mirror-top-perms | 7 +++---- 6 files changed, 15 insertions(+), 24 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..99a57a69f3a 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -108,12 +108,15 @@ def init_directories(self) -> None: SAMPLE_IMG_DIR OUTPUT_DIR """ - 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 + + # Path where qemu goodies live in this source tree. + qemu_srctree_path =3D Path(__file__, '../../../python').resolve() + + self.pythonpath =3D os.pathsep.join(filter(None, ( + self.source_iotests, + str(qemu_srctree_path), + os.getenv('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 Fri May 17 10:13:23 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 1632421049990464.0120759346205; Thu, 23 Sep 2021 11:17:29 -0700 (PDT) Received: from localhost ([::1]:56940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTHk-00014J-RA for importer@patchew.org; Thu, 23 Sep 2021 14:17:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8M-0005QJ-Lj for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37121) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT87-0003V7-RP for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07: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-578-9RGM_TMiPfGWlt35GiA0HA-1; Thu, 23 Sep 2021 14:07:28 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 50394802B9F; Thu, 23 Sep 2021 18:07:27 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4650760BE5; Thu, 23 Sep 2021 18:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420450; 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=+H5gJnGpF/udpFAg+KQlGrwNrJo5CCs9ITulO7bn3W0=; b=LxvZyn9NNp/0RxbKgigymfBobmIe/v5yQfZkefxsfLx2bF5ybtmk8zrJcwxIVVQOOq628Z p9m7sg4bg1CJYa0z6/FacxK7Y1G7AVKNsKfAzJi8AFuxrleIJRDYTbFs9Bzdc188NIxwng +ZzXhtKqV/Q+pDq8Xj9eU5Y98ceTfuk= X-MC-Unique: 9RGM_TMiPfGWlt35GiA0HA-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 2/6] iotests: add warning for rogue 'qemu' packages Date: Thu, 23 Sep 2021 14:07:11 -0400 Message-Id: <20210923180715.4168522-3-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.473, 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 , Vladimir Sementsov-Ogievskiy , Daniel Berrange , qemu-block@nongnu.org, Hanna Reitz , 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: 1632421051989100001 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.) In the future, we will pivot to always preferring a specific installed instance of qemu python packages managed directly by iotests. For now simply warn if there is an ambiguity over which instance that iotests might use. Example: If a user has navigated to ~/src/qemu/python and executed `pip install .`, you will see output like this when running `./check`: WARNING: 'qemu' python packages will be imported from outside the source tr= ee ('/home/jsnow/src/qemu/python') Importing instead from '/home/jsnow/.local/lib/python3.9/site-pack= ages/qemu' Signed-off-by: John Snow --- tests/qemu-iotests/testenv.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index 99a57a69f3a..1c0f6358538 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 @@ -112,6 +114,27 @@ 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 namespace packages + # (using qemu.qmp as a bellwether) from an unexpected location. + # i.e. the package is already installed in the user's environment. + try: + qemu_spec =3D importlib.util.find_spec('qemu.qmp') + except ModuleNotFoundError: + qemu_spec =3D None + + if qemu_spec and qemu_spec.origin: + spec_path =3D Path(qemu_spec.origin) + try: + _ =3D spec_path.relative_to(qemu_srctree_path) + except ValueError: + self._logger.warning( + "WARNING: 'qemu' python packages will be imported from" + " outside the source tree ('%s')", + qemu_srctree_path) + self._logger.warning( + " Importing instead from '%s'", + spec_path.parents[1]) + self.pythonpath =3D os.pathsep.join(filter(None, ( self.source_iotests, str(qemu_srctree_path), @@ -230,6 +253,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 Fri May 17 10:13:23 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 1632420630347204.46822676949444; Thu, 23 Sep 2021 11:10:30 -0700 (PDT) Received: from localhost ([::1]:43166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTAz-0008EB-6Y for importer@patchew.org; Thu, 23 Sep 2021 14:10:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55586) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8H-0005P0-99 for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:41 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:38059) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT89-0003VR-FF for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07: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-103-1nysA12EOmqPV9NjDKPCfw-1; Thu, 23 Sep 2021 14:07:29 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8B419100C610; Thu, 23 Sep 2021 18:07:28 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7805B60BE5; Thu, 23 Sep 2021 18:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420450; 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=x3mB/jUfTFsmSeR08JYtAdfdRcMdpeqpVxPtb8l21C8=; b=Eu+tWowDa6bEqLurTxXMXOcBvVyn/HhzvLfL5hjeHEf97oCA3l7SmcA2cqf7oKbblMg+In FIxL/AFbktEZkv8ULwUEieL7Yjs8GsBTl28jawSB8hE9OwiuNdbURns4N/6sBDc8EPD4Fy iZH+0D7wUH8BZLIR0h3dCbU0gQwmbJQ= X-MC-Unique: 1nysA12EOmqPV9NjDKPCfw-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 3/6] iotests/linters: check mypy files all at once Date: Thu, 23 Sep 2021 14:07:12 -0400 Message-Id: <20210923180715.4168522-4-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.473, 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 , Daniel Berrange , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , 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: 1632420631837100001 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 Reviewed-by: Kevin Wolf --- 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 Fri May 17 10:13:23 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 1632420639245165.97726758176645; Thu, 23 Sep 2021 11:10:39 -0700 (PDT) Received: from localhost ([::1]:43772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTB8-0000DO-46 for importer@patchew.org; Thu, 23 Sep 2021 14:10:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8J-0005Q3-KO for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50512) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT89-0003WT-Ef for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:43 -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-259-ex2dhtfgNFqQeVjtuhNNug-1; Thu, 23 Sep 2021 14:07:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C18C0100C618; Thu, 23 Sep 2021 18:07:29 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0DD660BE5; Thu, 23 Sep 2021 18:07:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420452; 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=cPl2YszrWK4ExfevnkHRDbrxmbkkgUyFW+6wQzbiA0I=; b=U1P1Nuntu9glWEG8OMm42oPiL0d0RtPdZ5LiiWPFLSnmWR5hS8WlLEgGjfG4XTiHUiorcr ohVmVjst5S9pnGaS3s5JYHXffc11BX+fsUnqmLcv+7dkZWaomNyZQaGi1aARwR+LzVGEJU QGgWPmHa2go+yyGKaa5krkoxpyKWZQQ= X-MC-Unique: ex2dhtfgNFqQeVjtuhNNug-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 4/6] iotests/mirror-top-perms: Adjust imports Date: Thu, 23 Sep 2021 14:07:13 -0400 Message-Id: <20210923180715.4168522-5-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.473, 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 , Daniel Berrange , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , 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: 1632420640863100001 We need to import subpackages from the qemu namespace package; importing the namespace package alone doesn't bring the subpackages 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 Reviewed-by: Kevin Wolf --- 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 Fri May 17 10:13:23 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 163242085740110.416184177779883; Thu, 23 Sep 2021 11:14:17 -0700 (PDT) Received: from localhost ([::1]:51292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTEe-0005b0-DH for importer@patchew.org; Thu, 23 Sep 2021 14:14:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8L-0005QB-Kk for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8B-0003Y6-19 for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07: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-475-1fZ683zQMm2ATtx3bI-hFg-1; Thu, 23 Sep 2021 14:07:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 694B3BBEE6; Thu, 23 Sep 2021 18:07:31 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13C8960BF1; Thu, 23 Sep 2021 18:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420453; 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=KBYlvTHwKhBgcJTPO9PWNR+qRzDAVPvMDvu1u116h0Y=; b=OMX7OQNfMWkgMvslfsH21nSLz195LZ8947TvPXMmWzKCXiAW5mxGY5l0bk6gYDvRJA/KEg u0MVZAEEsr80MWh2seJ2V85YQJW5IBOuwhFRkr4PoTqH5ey2kILd0B9FSaPlaKvf1weWue nHXXXFwpOi/8XWI3ocMhtUk4Bs+tnWQ= X-MC-Unique: 1fZ683zQMm2ATtx3bI-hFg-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 5/6] iotests/migrate-bitmaps-test: delint Date: Thu, 23 Sep 2021 14:07:14 -0400 Message-Id: <20210923180715.4168522-6-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.473, 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 , Daniel Berrange , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Hanna Reitz , 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: 1632420858627100001 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 Reviewed-by: Kevin Wolf --- 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 Fri May 17 10:13:23 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 1632421093846955.9001680654012; Thu, 23 Sep 2021 11:18:13 -0700 (PDT) Received: from localhost ([::1]:57660 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTIS-0001YK-RG for importer@patchew.org; Thu, 23 Sep 2021 14:18:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8N-0005Ru-VL for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07:49 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8J-0003dY-CT for qemu-devel@nongnu.org; Thu, 23 Sep 2021 14:07: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-373-KardLKk7Nm6fKxi_n1T5kQ-1; Thu, 23 Sep 2021 14:07:40 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74B5984A5E4; Thu, 23 Sep 2021 18:07:39 +0000 (UTC) Received: from scv.redhat.com (unknown [10.22.9.55]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEADD60BE5; Thu, 23 Sep 2021 18:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632420461; 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=eOfI6MlNj4jDk0jYu//dcGMOJrF2E1EN/J3ZcCDNs2s=; b=BFSPXtoyGLZQH0uHAYeQ9fcT4t80X9ac8IkhteyMIyGENsdTP/+eeqXGttTqnJxuJsgkB9 q6aOZF3EBNiq+LqaxMI7JgEg0PkrtvpMPh+QmIWlCmOYIkXILzEcOrxo/FoSBv9ewAMJyY tTahT4G+28iqoPdhhY/7tdJdgFirl/s= X-MC-Unique: KardLKk7Nm6fKxi_n1T5kQ-1 From: John Snow To: qemu-devel@nongnu.org Subject: [PATCH v2 6/6] iotests: Update for pylint 2.11.1 Date: Thu, 23 Sep 2021 14:07:15 -0400 Message-Id: <20210923180715.4168522-7-jsnow@redhat.com> In-Reply-To: <20210923180715.4168522-1-jsnow@redhat.com> References: <20210923180715.4168522-1-jsnow@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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: -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.473, 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 , Vladimir Sementsov-Ogievskiy , Daniel Berrange , qemu-block@nongnu.org, Hanna Reitz , 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: 1632421094492100001 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 Reviewed-by: Kevin Wolf --- 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