mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 17:27:31 +00:00
argparse: work around bad default in py 3.7.0a/b/rc, fixes #3996
This commit is contained in:
parent
eb6481e8d3
commit
52f1cd4bc6
1 changed files with 7 additions and 1 deletions
|
@ -3669,7 +3669,13 @@ def basic_parser(self):
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def subparsers(self, basic_parser):
|
def subparsers(self, basic_parser):
|
||||||
return basic_parser.add_subparsers(title='required arguments', metavar='<command>')
|
if sys.version_info >= (3, 7):
|
||||||
|
# py37 pre-release defaults to unwanted required=True, in 3.7.0+ it was fixed to =False
|
||||||
|
return basic_parser.add_subparsers(title='required arguments', metavar='<command>', required=False)
|
||||||
|
else:
|
||||||
|
# py36 does not support required=... argument (but behaves like required=False).
|
||||||
|
# note: use below call for 3.6 and 3.7 when there are no alphas/betas/RCs of 3.7.0 around any more.
|
||||||
|
return basic_parser.add_subparsers(title='required arguments', metavar='<command>')
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def parser(self, basic_parser):
|
def parser(self, basic_parser):
|
||||||
|
|
Loading…
Reference in a new issue