|
From: | Vladimir Sementsov-Ogievskiy |
Subject: | Re: [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command |
Date: | Tue, 23 Mar 2021 20:39:02 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 |
23.03.2021 20:22, Paolo Bonzini wrote:
On 23/03/21 18:11, Vladimir Sementsov-Ogievskiy wrote:If you have positional arguments that must begin with - and don’t look like negative numbers, you can insert the pseudo-argument '--' which tells parse_args() that everything after that is a positional argument:So, as I understand argparse supports '--' feature out of the box. So, we can keep '*' as is, and it would parse all remaining positional arguments which are either tests or the command, and '--' will be automatically dropped. So, we only need to check existing of '--' in original sys.argv to chose our behavior.There is still a difference with REMAINDER: ./check aa -- bb => REMAINDER: error because ./-- is not a test => look for '--': invoke "aa -- bb" So I think REMAINDER provides the best behavior overall.
Ok, with '*' you need to check that exactly sys.argv[-len(agrs.tests)-1] == '--', which gives the same behavior as REMAINDER. I'm OK with REMAINDER too, still with we probably also need some comment to not embarrass next person who go into documentation and not find it. -- Best regards, Vladimir
[Prev in Thread] | Current Thread | [Next in Thread] |