qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formattin


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH] image-fuzzer: Trivial readability and formatting improvements
Date: Tue, 19 Aug 2014 12:57:29 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

"M.Kustova" <address@hidden> writes:

> On Tue, Aug 19, 2014 at 1:44 PM, Fam Zheng <address@hidden> wrote:
>> On Tue, 08/19 02:00, Maria Kustova wrote:
[...]
>>> diff --git a/tests/image-fuzzer/runner.py b/tests/image-fuzzer/runner.py
>>> index fd97c40..b142577 100755
>>> --- a/tests/image-fuzzer/runner.py
>>> +++ b/tests/image-fuzzer/runner.py
[...]
>>> @@ -279,29 +277,30 @@ class TestEnv(object):
>>>                             "Backing file: %s\n" \
>>>                             % (self.seed, " ".join(current_cmd),
>>>                                self.current_dir, backing_file_name)
>>> -
>>>              temp_log = StringIO.StringIO()
>>>              try:
>>>                  retcode = run_app(temp_log, current_cmd)
>>>              except OSError, e:
>>> -                multilog(test_summary + "Error: Start of '%s' failed. " \
>>> -                         "Reason: %s\n\n" % (os.path.basename(
>>> -                             current_cmd[0]), e[1]),
>>> +                multilog(test_summary +
>>> +                         ("Error: Start of '%s' failed. Reason: %s\n\n"
>>> +                          % (os.path.basename(current_cmd[0]), e[1])),
>>
>> I prefer the old one. I don't like the special case in python syntax: '(val)'
>> is just val, but '(val1, val2)' is a tuple.
>
> This 'tuple' format provides that '%' substitution will be applied
> only to the string in the parentheses,
> instead of an entire string (in this case including test summary).
> The same rationale for cases below.

What about something like

                multilog("%sError: Start of '%s' failed. Reason: %s\n\n"
                         % (test_summary, os.path.basename(current_cmd[0]),
                            e[1]),
                         sys.stderr, self.log, self.parent_log)

[...]



reply via email to

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