[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test comman
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command |
Date: |
Tue, 23 Mar 2021 18:00:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
On 23/03/21 17:43, Vladimir Sementsov-Ogievskiy wrote:
Interesting that REMAINDER documentation disappeared from latest (3.9)
python documentation https://docs.python.org/3.9/library/argparse.html ,
but exists here https://docs.python.org/3.8/library/argparse.html (and
no mark of deprecation)
Whoa. https://bugs.python.org/issue17050 says:
---
Since this feature is buggy, and there isn't an easy fix, we should
probably remove any mention of it from the docs. We can still leave it
as an undocumented legacy feature.
There is precedent for leaving `nargs` constants undocumented.
`argparse.PARSER` ('+...') is used by the subparser mechanism, but is
not documented. https://bugs.python.org/issue16988
---
The problematic case appears to be when you have more than one
positional argument, which is exactly the case with the 3.8 documented
use of REMAINDER. Hence the decision to drop the documentation.
However, "check" works fine because the REMAINDER argument is the only
positional argument:
$ ./check 001 -d
Test "tests/-d" is not found
Another possibility is to pre-process sys.argv like this:
if '--' in sys.argv:
cmd = True
args = sys.argv[0:sys.argv.index('--')]
posargs = sys.argv[len(args)+1:]
else:
cmd = False
args = list(x for x in sys.argv if x.startswith('-'))
posargs = list(x for x in sys.argv if not x.startswith('-'))
But getting the help message right etc. would be messy.
Paolo
- [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, (continued)
- [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Paolo Bonzini, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Vladimir Sementsov-Ogievskiy, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Paolo Bonzini, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Vladimir Sementsov-Ogievskiy, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Vladimir Sementsov-Ogievskiy, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Paolo Bonzini, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Vladimir Sementsov-Ogievskiy, 2021/03/23
- Re: [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts, Paolo Bonzini, 2021/03/23
[PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command, Paolo Bonzini, 2021/03/23
[PATCH 2/4] qemu-iotests: move command line and environment handling from TestRunner to TestEnv, Paolo Bonzini, 2021/03/23
[PATCH 4/4] qemu-iotests: fix case of SOCK_DIR already in the environment, Paolo Bonzini, 2021/03/23