Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp776108pxb; Mon, 25 Oct 2021 18:43:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8seGwx31+RX9DdFjXOBS6wwSM7DLOie3fX7h24C9gxrLCCgpo94AZChSEUw5m0p85ZXcT X-Received: by 2002:a17:906:3b81:: with SMTP id u1mr22797396ejf.419.1635212632106; Mon, 25 Oct 2021 18:43:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635212632; cv=none; d=google.com; s=arc-20160816; b=vuQLUr3u30xtOSu381ITVEE6Zu65thL44OHLiECLNfHJXBSXRxurWIaXYTfara4LuX tBDVoHXOasiVPIaARu5XAvAjPFNQA5Mbn4+9m++3xF8awTgfv4Ov3xlroSCxIfK3mTDg CEk7gKfazExNcmHNb+ejVcpgE2+sb6tuvEH3w+m4Hvw7Sqz0STqm4YCNwre0GJCYa6cW RdKbNZnvcRY55FNyDO1RuyBR5/4UKEG3azRuISuRIyjZyet22oSQBJFwueiWP+rvWL0o fSpT8EHrV4Sdmw75tTxgOGrXHolo+sXXOpyoCzBnXO7JjPGs/uQVJRlbMI2hvv1uf5l8 rayA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pKq2jb5/3JE7fNMhMAROX1b14m7uUaxWDnNmF54psuc=; b=ERobGoUYxJkuMSBRQatkU9QutHaevTZNevhekKI9V8x8/E5ZaLYHtmR943NMgpL1dh Ka+1jZPm4JLvFRidH8uXNAlKrCga5OV9mK8KARUAbXRDFWORN2TDWJoa/vRJbYwcJa9b OXmv0gMiifXwbaUEdB6+NliR7sn3g+n7F7VNWxIwu6pJe0HnokychJb+run7R/yb/4SI 5S5aIUC6PJiIekYS2A3e36UUcYXrl50OdWIu4N7GBPS2Aeozs46Bz2Kt7VXTTwpXX6jS Fji9gRFWkd2nLdf6Qe8WYUU0tKG6Q6QJbwp2MKXQj/Z56LozErJo/VRa5uFZ0V17t528 QZAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fMajqLIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw22si38691768ejc.284.2021.10.25.18.43.28; Mon, 25 Oct 2021 18:43:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=fMajqLIb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233695AbhJYV3O (ORCPT + 99 others); Mon, 25 Oct 2021 17:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233740AbhJYV27 (ORCPT ); Mon, 25 Oct 2021 17:28:59 -0400 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E97E7C061767 for ; Mon, 25 Oct 2021 14:26:36 -0700 (PDT) Received: by mail-pf1-x432.google.com with SMTP id l203so7463297pfd.2 for ; Mon, 25 Oct 2021 14:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pKq2jb5/3JE7fNMhMAROX1b14m7uUaxWDnNmF54psuc=; b=fMajqLIbFXGo6lfFZJpr+3FhWBvfEyPg7nhATu486MiDFFsDTZXL4CpTl4ITO3tVj5 nOpIXXX27ba621rMo8ep4Eeffph8d6hke3AGXnIozvXTmek0cZuwXK5BLKZD6+2Fxtlv FnoNEECto+hU34xw07QHvk9hf63FnV/C1s/OIjmbTZmqR6rAPmhw3RgkRoJ3AKrU4Pm8 kHDKwd01rnhAekLmuaG7PuPwbb/wceFGmQhNqG48UmnrdzS6XJHdw09sTRKltsupyEpX 6kPjcCRCayE1o5LrkfUUkofWylqoyR0xMoZtPVm2a9xPSNpXtBjXZ7SQL60ynMxyC4AL J5bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pKq2jb5/3JE7fNMhMAROX1b14m7uUaxWDnNmF54psuc=; b=ey05J+ERsV8Vfchhtmamr6mx9/LAYpcFr/Odk6b15JDGmmRDi/2yVcrMAjFqd5UL6/ yrsYHmPLp1w2y0AKF5Bpl4YBr3C8JswPHHWK6ej3z8OvyVr9KgzME4ihhcf2fNbny7y4 ZQyYQTBlQq1CwaQ9DZDGnfquvf1ZyjZT/Fot4bLlCdvVH3kGVA0wuMQ91dyeeBX3HagT o1Ku0DE1bYkASDsHe/ESLOrYo5Jiz50ukYVWWrJI9zBBYUXYRC4tnCalYIvhZxNgmDzP 30fJ3XKP30nUxMo2fDUVpgh5X4g4xmAUiWGnCG6w92FCbzhq5gIJZQSeq2lsV64wKThU qP+Q== X-Gm-Message-State: AOAM532fFgZA4m32+qyWWBVNtepiwvwooBqDxhIXihrPMxJxPMNYghk1 4jJdXFlvyLVKuyUrWY2H0jZfOGj7TslA0CXQDeRxBw== X-Received: by 2002:a05:6a00:2296:b0:44d:e2f7:4d1c with SMTP id f22-20020a056a00229600b0044de2f74d1cmr21034943pfe.63.1635197196182; Mon, 25 Oct 2021 14:26:36 -0700 (PDT) MIME-Version: 1.0 References: <20211022004936.2049804-1-dlatypov@google.com> In-Reply-To: <20211022004936.2049804-1-dlatypov@google.com> From: Brendan Higgins Date: Mon, 25 Oct 2021 14:26:25 -0700 Message-ID: Subject: Re: [PATCH] kunit: tool: fix typecheck errors about loading qemu configs To: Daniel Latypov Cc: davidgow@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 5:49 PM 'Daniel Latypov' via KUnit Development wrote: > > Currently, we have these errors: > $ mypy ./tools/testing/kunit/*.py > tools/testing/kunit/kunit_kernel.py:213: error: Item "_Loader" of "Optional[_Loader]" has no attribute "exec_module" > tools/testing/kunit/kunit_kernel.py:213: error: Item "None" of "Optional[_Loader]" has no attribute "exec_module" > tools/testing/kunit/kunit_kernel.py:214: error: Module has no attribute "QEMU_ARCH" > tools/testing/kunit/kunit_kernel.py:215: error: Module has no attribute "QEMU_ARCH" > > exec_module > =========== > > pytype currently reports no errors, but that's because there's a comment > disabling it on 213. > > This is due to https://github.com/python/typeshed/pull/2626. > The fix is to assert the loaded module implements the ABC > (abstract base class) we want which has exec_module support. > > QEMU_ARCH > ========= > > pytype is fine with this, but mypy is not: > https://github.com/python/mypy/issues/5059 > > Add a check that the loaded module does indeed have QEMU_ARCH. > Note: this is not enough to appease mypy, so we also add a comment to > squash the warning. > > Signed-off-by: Daniel Latypov Thanks! I could not figure out how to make this work for both type checkers on my own. Reviewed-by: Brendan Higgins