1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-24 15:12:00 +00:00

Check borgfs man formatting in tests

I only realized after the first PR was merged that the code used for
finding which man pages to generate was duplicated in the testsuite
(since setup.py can't import from the installed module and vice versa.)
These are essentially the same changes as made to setup.py in #3290.
This commit is contained in:
Milkey Mouse 2017-11-12 18:36:06 -08:00
parent eadb74eb6f
commit 0ec703ff40
No known key found for this signature in database
GPG key ID: C6EF5A02F5647987

View file

@ -3655,14 +3655,17 @@ def get_all_parsers():
Return dict mapping command to parser.
"""
parser = Archiver(prog='borg').build_parser()
borgfs_parser = Archiver(prog='borgfs').build_parser()
parsers = {}
def discover_level(prefix, parser, Archiver):
def discover_level(prefix, parser, Archiver, extra_choices=None):
choices = {}
for action in parser._actions:
if action.choices is not None and 'SubParsersAction' in str(action.__class__):
for cmd, parser in action.choices.items():
choices[prefix + cmd] = parser
if extra_choices is not None:
choices.update(extra_choices)
if prefix and not choices:
return
@ -3670,7 +3673,7 @@ def discover_level(prefix, parser, Archiver):
discover_level(command + " ", parser, Archiver)
parsers[command] = parser
discover_level("", parser, Archiver)
discover_level("", parser, Archiver, {'borgfs': borgfs_parser})
return parsers