qemu-block
[Top][All Lists]
Advanced

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

Re: [PATCH v3 4/5] iotests: make qemu_img raise on non-zero rc by defaul


From: John Snow
Subject: Re: [PATCH v3 4/5] iotests: make qemu_img raise on non-zero rc by default
Date: Thu, 17 Mar 2022 11:24:34 -0400

On Thu, Mar 17, 2022 at 6:25 AM Hanna Reitz <hreitz@redhat.com> wrote:
>
> On 08.03.22 02:57, John Snow wrote:

> > +    if check and subp.returncode or (subp.returncode < 0):
>
> I wouldn’t expect these parentheses here in any other language, are they
> required in Python?
>

It's not required, I just find it easier to read this way.

> > +        raise VerboseProcessError(
> > +            subp.returncode, full_args,
> > +            output=subp.stdout,
> > +            stderr=subp.stderr,
> > +        )
>
> I trust these parameters are correct, because it really sometimes seems
> like Python doc doesn’t want to tell me about the arguments that
> constructors take.  (The only thing I found out is that `stdout` works
> as an alias for `output`, so passing `output` here and reading
> `self.stdout` in `VerboseProcesError` should(tm) be fine.)
>

>>> import subprocess
>>> help(subprocess.CalledProcessError)

 |  __init__(self, returncode, cmd, output=None, stderr=None)
 |      Initialize self.  See help(type(self)) for accurate signature.

It should be fine :tm:

--js




reply via email to

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