Sort generated flags before passing them to Borg.
This commit is contained in:
parent
86dbc00cbe
commit
56fd78089d
2 changed files with 3 additions and 5 deletions
|
@ -25,7 +25,7 @@ def make_flags_from_arguments(arguments, excludes=()):
|
||||||
return tuple(
|
return tuple(
|
||||||
itertools.chain.from_iterable(
|
itertools.chain.from_iterable(
|
||||||
make_flags(name, value=getattr(arguments, name))
|
make_flags(name, value=getattr(arguments, name))
|
||||||
for name in vars(arguments)
|
for name in sorted(vars(arguments))
|
||||||
if name not in excludes and not name.startswith('_')
|
if name not in excludes and not name.startswith('_')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,16 +23,14 @@ def test_make_flags_formats_name_with_underscore():
|
||||||
assert module.make_flags('posix_me_harder', 'okay') == ('--posix-me-harder', 'okay')
|
assert module.make_flags('posix_me_harder', 'okay') == ('--posix-me-harder', 'okay')
|
||||||
|
|
||||||
|
|
||||||
def test_make_flags_from_arguments_flattens_multiple_arguments():
|
def test_make_flags_from_arguments_flattens_and_sorts_multiple_arguments():
|
||||||
flexmock(module).should_receive('make_flags').with_args('foo', 'bar').and_return(('foo', 'bar'))
|
flexmock(module).should_receive('make_flags').with_args('foo', 'bar').and_return(('foo', 'bar'))
|
||||||
flexmock(module).should_receive('make_flags').with_args('baz', 'quux').and_return(
|
flexmock(module).should_receive('make_flags').with_args('baz', 'quux').and_return(
|
||||||
('baz', 'quux')
|
('baz', 'quux')
|
||||||
)
|
)
|
||||||
arguments = flexmock(foo='bar', baz='quux')
|
arguments = flexmock(foo='bar', baz='quux')
|
||||||
|
|
||||||
assert sorted(module.make_flags_from_arguments(arguments)) == sorted(
|
assert module.make_flags_from_arguments(arguments) == ('baz', 'quux', 'foo', 'bar')
|
||||||
('foo', 'bar', 'baz', 'quux')
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_make_flags_from_arguments_excludes_underscored_argument_names():
|
def test_make_flags_from_arguments_excludes_underscored_argument_names():
|
||||||
|
|
Loading…
Reference in a new issue