1
0
Fork 0
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:
Thomas Waldmann 2018-07-30 01:02:25 +01:00
parent eb6481e8d3
commit 52f1cd4bc6

View file

@ -3669,6 +3669,12 @@ def basic_parser(self):
@pytest.fixture
def subparsers(self, basic_parser):
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