All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [PATCH v6 2/9] iotests: add script_initialize
Date: Tue, 3 Mar 2020 16:12:50 -0500	[thread overview]
Message-ID: <4956bbaf-a909-0baf-4c4f-1cb3db5d0d22@redhat.com> (raw)
In-Reply-To: <54340b90-9b8e-6636-af38-c64b9ad9fee9@redhat.com>



On 2/27/20 8:47 AM, Max Reitz wrote:
> On 27.02.20 01:06, John Snow wrote:
>> Like script_main, but doesn't require a single point of entry.
>> Replace all existing initialization sections with this drop-in replacement.
>>
>> This brings debug support to all existing script-style iotests.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>  tests/qemu-iotests/149        |  3 +-
>>  tests/qemu-iotests/194        |  4 +-
>>  tests/qemu-iotests/202        |  4 +-
>>  tests/qemu-iotests/203        |  4 +-
>>  tests/qemu-iotests/206        |  2 +-
>>  tests/qemu-iotests/207        |  6 ++-
>>  tests/qemu-iotests/208        |  2 +-
>>  tests/qemu-iotests/209        |  2 +-
>>  tests/qemu-iotests/210        |  6 ++-
>>  tests/qemu-iotests/211        |  6 ++-
>>  tests/qemu-iotests/212        |  6 ++-
>>  tests/qemu-iotests/213        |  6 ++-
>>  tests/qemu-iotests/216        |  4 +-
>>  tests/qemu-iotests/218        |  2 +-
>>  tests/qemu-iotests/219        |  2 +-
>>  tests/qemu-iotests/222        |  7 ++--
>>  tests/qemu-iotests/224        |  4 +-
>>  tests/qemu-iotests/228        |  6 ++-
>>  tests/qemu-iotests/234        |  4 +-
>>  tests/qemu-iotests/235        |  4 +-
>>  tests/qemu-iotests/236        |  2 +-
>>  tests/qemu-iotests/237        |  2 +-
>>  tests/qemu-iotests/238        |  2 +
>>  tests/qemu-iotests/242        |  2 +-
>>  tests/qemu-iotests/246        |  2 +-
>>  tests/qemu-iotests/248        |  2 +-
>>  tests/qemu-iotests/254        |  2 +-
>>  tests/qemu-iotests/255        |  2 +-
>>  tests/qemu-iotests/256        |  2 +-
>>  tests/qemu-iotests/258        |  7 ++--
>>  tests/qemu-iotests/260        |  4 +-
>>  tests/qemu-iotests/262        |  4 +-
>>  tests/qemu-iotests/264        |  4 +-
>>  tests/qemu-iotests/277        |  2 +
>>  tests/qemu-iotests/280        |  8 ++--
>>  tests/qemu-iotests/283        |  4 +-
>>  tests/qemu-iotests/iotests.py | 73 +++++++++++++++++++++++------------
>>  37 files changed, 128 insertions(+), 80 deletions(-)
> 
> Reviewed-by: Max Reitz <mreitz@redhat.com>
> 
> [...]
> 
>> diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
>> index e8a0ea14fc..fdcf8a940c 100644
>> --- a/tests/qemu-iotests/iotests.py
>> +++ b/tests/qemu-iotests/iotests.py
> 
> [...]
> 
>> @@ -1092,13 +1105,18 @@ def execute_unittest(output, verbosity, debug):
>>  
>>              sys.stderr.write(out)
>>  
>> -def execute_test(test_function=None,
>> -                 supported_fmts=[],
>> -                 supported_platforms=None,
>> -                 supported_cache_modes=[], supported_aio_modes={},
>> -                 unsupported_fmts=[], supported_protocols=[],
>> -                 unsupported_protocols=[]):
>> -    """Run either unittest or script-style tests."""
>> +def execute_setup_common(supported_fmts: Collection[str] = (),
> 
> First time I see something like this, but I suppose it means any
> collection (i.e. list or tuple in this case) that has str values?
> 
> Max
> 

Yes. Testing the waters for idiomatic type annotations. We chose our
python version to allow us to use them, so I'm pushing on that boundary.

A Collection in this case is a Python ABC that collects the Sized,
Iterable and Container ABCs.

Roughly:
Sized: provides __len__          (len(x))
Iterable: provides __iter__      ("for x in y")
Container: provides __contains__ ("if 'x' in y")

In this case, we want Iterable (to enumerate the atoms) and Sized (to
provide truth-testing that returns False when the collection has a size
of zero.) "Collection" is the nearest available type that describes all
of the desired types of duck, without becoming overly specific for
features of the type we are not using.

More information:
https://docs.python.org/3.6/library/collections.abc.html#module-collections.abc

>> +                         supported_platforms: Collection[str] = (),
>> +                         supported_cache_modes: Collection[str] = (),
>> +                         supported_aio_modes: Collection[str] = (),
>> +                         unsupported_fmts: Collection[str] = (),
>> +                         supported_protocols: Collection[str] = (),
>> +                         unsupported_protocols: Collection[str] = ()) -> bool:
> 



  reply	other threads:[~2020-03-03 21:13 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27  0:06 [PATCH v6 0/9] iotests: use python logging John Snow
2020-02-27  0:06 ` [PATCH v6 1/9] iotests: do a light delinting John Snow
2020-02-27 12:59   ` Max Reitz
2020-03-03 21:25     ` John Snow
2020-03-04 11:12       ` Kevin Wolf
2020-03-04 18:35         ` John Snow
2020-02-27  0:06 ` [PATCH v6 2/9] iotests: add script_initialize John Snow
2020-02-27 13:47   ` Max Reitz
2020-03-03 21:12     ` John Snow [this message]
2020-02-27  0:06 ` [PATCH v6 3/9] iotests: replace mutable list default args John Snow
2020-02-27 13:50   ` Max Reitz
2020-02-27  0:06 ` [PATCH v6 4/9] iotest 258: use script_main John Snow
2020-02-27 13:55   ` Max Reitz
2020-02-27 14:10   ` Philippe Mathieu-Daudé
2020-02-27  0:06 ` [PATCH v6 5/9] iotests: Mark verify functions as private John Snow
2020-02-27 13:59   ` Max Reitz
2020-02-27  0:06 ` [PATCH v6 6/9] iotests: use python logging for iotests.log() John Snow
2020-02-27 14:21   ` Max Reitz
2020-03-03 20:00     ` John Snow
2020-02-27  0:06 ` [PATCH v6 7/9] iotests: ignore import warnings from pylint John Snow
2020-02-27 14:14   ` Philippe Mathieu-Daudé
2020-03-03 19:57     ` John Snow
2020-03-04  0:02       ` Philippe Mathieu-Daudé
2020-03-04 18:59         ` John Snow
2020-02-27  0:06 ` [PATCH v6 8/9] iotests: don't use 'format' for drive_add John Snow
2020-02-27 14:12   ` Philippe Mathieu-Daudé
2020-02-27 14:26   ` Max Reitz
2020-02-27  0:06 ` [PATCH v6 9/9] iotests: add pylintrc file John Snow
2020-02-27  1:57   ` Eric Blake
2020-02-27 14:11   ` Philippe Mathieu-Daudé
2020-03-03 19:52     ` John Snow
2020-03-04  7:22   ` Markus Armbruster
2020-03-04 19:17     ` John Snow
2020-03-05  5:49       ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4956bbaf-a909-0baf-4c4f-1cb3db5d0d22@redhat.com \
    --to=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.