qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] qemu-iotests: fix pylint 2.8 consider-using-with error


From: Emanuele Giuseppe Esposito
Subject: Re: [PATCH v2] qemu-iotests: fix pylint 2.8 consider-using-with error
Date: Fri, 14 May 2021 16:40:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1



On 14/05/2021 16:09, Max Reitz wrote:
On 12.05.21 19:04, Max Reitz wrote:
On 10.05.21 21:04, Emanuele Giuseppe Esposito wrote:
pylint 2.8 introduces consider-using-with error, suggesting
to use the 'with' block statement when possible.

Modify all subprocess.Popen call to use the 'with' statement,
except the one in __init__ of QemuIoInteractive class, since
it is assigned to a class field and used in other methods.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
v1 -> v2:
* fix indentation [Max]
* explain why we disabled the check in QemuIoInteractive's __init__ [Max]

Thanks!

Applied to my block branch:

https://github.com/XanClic/qemu/commits/block

I’ve just seen that the “# pylint: disable=consider-using-with” line causes a warning in pylint versions that don’t know that warning…

I’d like to squash this in:

diff --git a/tests/qemu-iotests/pylintrc b/tests/qemu-iotests/pylintrc
index 7a6c0a9474..f2c0b522ac 100644
--- a/tests/qemu-iotests/pylintrc
+++ b/tests/qemu-iotests/pylintrc
@@ -19,6 +19,9 @@ disable=invalid-name,
         too-many-public-methods,
         # pylint warns about Optional[] etc. as unsubscriptable in 3.9
         unsubscriptable-object,
+        # Sometimes we need to disable a newly introduced pylint warning. +        # Doing so should not produce a warning in older versions of pylint.
+        bad-option-value,
         # These are temporary, and should be removed:
         missing-docstring,
         too-many-return-statements,

Would that be OK for you?

I see... Looks good to me, this also prevents the same problem with other pylint options that can be introduced in the future.

Thank you,
Emanuele




reply via email to

[Prev in Thread] Current Thread [Next in Thread]