Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp184025pxu; Wed, 2 Dec 2020 19:10:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJ3VUp73TUk6BSksAUBNs5pVvL72jOthd3hPB5mfdLi5qCPhVkoNh8IBN0yvRyp/WxyZny X-Received: by 2002:a17:906:770d:: with SMTP id q13mr714402ejm.409.1606965026703; Wed, 02 Dec 2020 19:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606965026; cv=none; d=google.com; s=arc-20160816; b=PLTaBOEqccjhcOXzseE4bdjGmVhngicesBn8k8KaaG8ZP/3ip2YNL/U2Id8m2k49QM EHJntHCGnPNzVdKgBC6e+tBoIHVCx7bKiYlWmYbl8Kl+znp2HIsjtRcUxk9M0heHf0hF /3s0RRLJqTDH0a+44CJO4yMemPiV6jjpWN/z1PHOjQ/skJRl/0OZtn+t7Pq8lnGozhyc nkHvNrC/8MHsb2oSJET3NEmG698m4LapiXuhX+jhlxfiKJ3CuKn3gbqCscvCBs/lJXDx btmfBueOew7rWI3ZhDKCT1d+6ltkflpzc7a7gUVwc9RsW4Y5DjsUhtQ0W6AhgfHsABpE zygw== 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=iabHWxPKR0AIdSLCLpw/C98fo9E+QLOwHBUfijaTHQI=; b=KH4y0u35ZMS5W+0/KjFiT6YSrRQ6JYQpQsyy2Q7YASbkMn6MF4hflXn6LdlgG9JmH9 FMUjSkUwM+2inXdZ7bTWmYItfBuziyORyR0ZIUnkluHGUkVNKl9aMrsbpQcr5fX2d0md uMLSSFmVLCrEZncKPdL9zFCc71cIXaXphZQZpCDx30bIwVq70mQqJawoIVQlthILMZ2X Q/upJobacH+Xnp0G1QEm8PCfXIH3+xwMBgaJkYA1eSDT6VhLVjaL24PNIIb+e/qSphdj h4+E7OjHkdVp9TDS3LSOU2o3teDQ2kcpFXZ7GG0eQxnA/HPKpkluqyWcNCyBrD4rhYHn NkVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AUQsOHkB; 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 q23si213359edb.184.2020.12.02.19.10.02; Wed, 02 Dec 2020 19:10:26 -0800 (PST) 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=20161025 header.b=AUQsOHkB; 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 S1727855AbgLCDHE (ORCPT + 99 others); Wed, 2 Dec 2020 22:07:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgLCDHE (ORCPT ); Wed, 2 Dec 2020 22:07:04 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C08C061A52 for ; Wed, 2 Dec 2020 19:06:18 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id u18so564276lfd.9 for ; Wed, 02 Dec 2020 19:06:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iabHWxPKR0AIdSLCLpw/C98fo9E+QLOwHBUfijaTHQI=; b=AUQsOHkBeiTCRFg84V/yDRz2/jWuR3J0fKxAp52o5M4SXIBufUW4si5duvf/GMoL1C swixKu+RjjKlS6wWmi4ALcrumj1I3aXZdS3MNLe1WCmrWmDvWBzShKcYMihiWhfD/m6N kMhh5OXRHnmsZXfwMXP9kMPMPmky/B5InN+Z7an/boun8bZWXBkBS5Xp8iH3BFKxlnO2 OFzLiyFIa7fykoAUXq1E1plqt4Ik2j1wNwUAAzhg7P0BKM1wibFomM5L6v97uI/U8AQl aTtaFfU5eHGq9ATsbpKp41UUmEI4AtWOrmwXDBBXiGUlyFLutxxVot0xPwYyTmWlKAoN SKgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iabHWxPKR0AIdSLCLpw/C98fo9E+QLOwHBUfijaTHQI=; b=bdjAFodaLVgjtnZwo1jjOqL0i672gNllqPlmAsJz/AdPJ1pb0Ej5w92RcucvW+Bq4l Tb04oQIlVTb6ONsAhMvnYVfOc9fmVn+pZzkAAG0RCbsTlUuk5SYTyoylijcJPpVw/TGQ Sugtmi0kVNDK+9PcODTxweCy9n2haz7U8wM+Ul8Sqfml21RslRzx/ufUKZa7edCLE8/p ovt8BUMS1oMs0THl7k3CwU82FEwT25GcWdpB1ykLCSArZFPqdUstinuIsVPbyOsxW6h+ K6gkLOfg3UcYVm7r9l7y56N38hHeE3dTiA6rvdLXnKvyv4J8gFf7nFSIYSA20LLkrUxx 5ceQ== X-Gm-Message-State: AOAM530ZEYD/yhwlkeHkqSkBOMi7R5KxTZO1ts39dJWt22QXksjBrQvD W2VhF6u5s6unh6kUPPv0EMk0LnodjyGyOBafn5Yv4Q== X-Received: by 2002:ac2:5102:: with SMTP id q2mr439864lfb.165.1606964776658; Wed, 02 Dec 2020 19:06:16 -0800 (PST) MIME-Version: 1.0 References: <20201202190824.1309398-1-dlatypov@google.com> <20201202190824.1309398-3-dlatypov@google.com> In-Reply-To: <20201202190824.1309398-3-dlatypov@google.com> From: David Gow Date: Thu, 3 Dec 2020 11:06:05 +0800 Message-ID: Subject: Re: [PATCH v2 3/4] kunit: tool: use `with open()` in unit test To: Daniel Latypov Cc: Brendan Higgins , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 3, 2020 at 3:09 AM Daniel Latypov wrote: > > The use of manual open() and .close() calls seems to be an attempt to > keep the contents in scope. > But Python doesn't restrict variables like that, so we can introduce new > variables inside of a `with` and use them outside. > > Do so to make the code more Pythonic. > > Signed-off-by: Daniel Latypov > --- Reviewed-by: David Gow Cheers, -- David