#21: Fix for verbosity flag not actually causing verbose output.

This commit is contained in:
Dan Helfman 2016-06-23 07:13:25 -07:00
parent 63c4bf3bf9
commit a45d7bec81
5 changed files with 24 additions and 20 deletions

4
NEWS
View file

@ -1,3 +1,7 @@
1.0.3
* #21: Fix for verbosity flag not actually causing verbose output.
1.0.2 1.0.2
* #20: Fix for traceback when remote_path option is missing. * #20: Fix for traceback when remote_path option is missing.

View file

@ -41,8 +41,8 @@ def create_archive(
one_file_system_flags = ('--one-file-system',) if one_file_system else () one_file_system_flags = ('--one-file-system',) if one_file_system else ()
remote_path_flags = ('--remote-path', remote_path) if remote_path else () remote_path_flags = ('--remote-path', remote_path) if remote_path else ()
verbosity_flags = { verbosity_flags = {
VERBOSITY_SOME: ('--stats',), VERBOSITY_SOME: ('--info', '--stats',),
VERBOSITY_LOTS: ('--verbose', '--stats'), VERBOSITY_LOTS: ('--debug', '--list', '--stats'),
}.get(verbosity, ()) }.get(verbosity, ())
full_command = ( full_command = (
@ -88,8 +88,8 @@ def prune_archives(verbosity, repository, retention_config, command=COMMAND, rem
''' '''
remote_path_flags = ('--remote-path', remote_path) if remote_path else () remote_path_flags = ('--remote-path', remote_path) if remote_path else ()
verbosity_flags = { verbosity_flags = {
VERBOSITY_SOME: ('--stats',), VERBOSITY_SOME: ('--info', '--stats',),
VERBOSITY_LOTS: ('--verbose', '--stats'), VERBOSITY_LOTS: ('--debug', '--stats'),
}.get(verbosity, ()) }.get(verbosity, ())
full_command = ( full_command = (
@ -171,8 +171,8 @@ def check_archives(verbosity, repository, consistency_config, command=COMMAND, r
remote_path_flags = ('--remote-path', remote_path) if remote_path else () remote_path_flags = ('--remote-path', remote_path) if remote_path else ()
verbosity_flags = { verbosity_flags = {
VERBOSITY_SOME: ('--verbose',), VERBOSITY_SOME: ('--info',),
VERBOSITY_LOTS: ('--verbose',), VERBOSITY_LOTS: ('--debug',),
}.get(verbosity, ()) }.get(verbosity, ())
full_command = ( full_command = (

View file

@ -102,8 +102,8 @@ def test_create_archive_with_none_excludes_filename_should_call_borg_without_exc
) )
def test_create_archive_with_verbosity_some_should_call_borg_with_stats_parameter(): def test_create_archive_with_verbosity_some_should_call_borg_with_info_parameter():
insert_subprocess_mock(CREATE_COMMAND + ('--stats',)) insert_subprocess_mock(CREATE_COMMAND + ('--info', '--stats',))
insert_platform_mock() insert_platform_mock()
insert_datetime_mock() insert_datetime_mock()
@ -117,8 +117,8 @@ def test_create_archive_with_verbosity_some_should_call_borg_with_stats_paramete
) )
def test_create_archive_with_verbosity_lots_should_call_borg_with_verbose_parameter(): def test_create_archive_with_verbosity_lots_should_call_borg_with_debug_parameter():
insert_subprocess_mock(CREATE_COMMAND + ('--verbose', '--stats')) insert_subprocess_mock(CREATE_COMMAND + ('--debug', '--list', '--stats'))
insert_platform_mock() insert_platform_mock()
insert_datetime_mock() insert_datetime_mock()
@ -283,12 +283,12 @@ def test_prune_archives_should_call_borg_with_parameters():
) )
def test_prune_archives_with_verbosity_some_should_call_borg_with_stats_parameter(): def test_prune_archives_with_verbosity_some_should_call_borg_with_info_parameter():
retention_config = flexmock() retention_config = flexmock()
flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return( flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return(
BASE_PRUNE_FLAGS, BASE_PRUNE_FLAGS,
) )
insert_subprocess_mock(PRUNE_COMMAND + ('--stats',)) insert_subprocess_mock(PRUNE_COMMAND + ('--info', '--stats',))
module.prune_archives( module.prune_archives(
repository='repo', repository='repo',
@ -298,12 +298,12 @@ def test_prune_archives_with_verbosity_some_should_call_borg_with_stats_paramete
) )
def test_prune_archives_with_verbosity_lots_should_call_borg_with_verbose_parameter(): def test_prune_archives_with_verbosity_lots_should_call_borg_with_debug_parameter():
retention_config = flexmock() retention_config = flexmock()
flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return( flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return(
BASE_PRUNE_FLAGS, BASE_PRUNE_FLAGS,
) )
insert_subprocess_mock(PRUNE_COMMAND + ('--verbose', '--stats',)) insert_subprocess_mock(PRUNE_COMMAND + ('--debug', '--stats',))
module.prune_archives( module.prune_archives(
repository='repo', repository='repo',
@ -400,12 +400,12 @@ def test_check_archives_should_call_borg_with_parameters():
) )
def test_check_archives_with_verbosity_some_should_call_borg_with_verbose_parameter(): def test_check_archives_with_verbosity_some_should_call_borg_with_info_parameter():
consistency_config = flexmock().should_receive('get').and_return(None).mock consistency_config = flexmock().should_receive('get').and_return(None).mock
flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_parse_checks').and_return(flexmock())
flexmock(module).should_receive('_make_check_flags').and_return(()) flexmock(module).should_receive('_make_check_flags').and_return(())
insert_subprocess_mock( insert_subprocess_mock(
('borg', 'check', 'repo', '--verbose'), ('borg', 'check', 'repo', '--info'),
stdout=None, stderr=STDOUT, stdout=None, stderr=STDOUT,
) )
insert_platform_mock() insert_platform_mock()
@ -419,12 +419,12 @@ def test_check_archives_with_verbosity_some_should_call_borg_with_verbose_parame
) )
def test_check_archives_with_verbosity_lots_should_call_borg_with_verbose_parameter(): def test_check_archives_with_verbosity_lots_should_call_borg_with_debug_parameter():
consistency_config = flexmock().should_receive('get').and_return(None).mock consistency_config = flexmock().should_receive('get').and_return(None).mock
flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_parse_checks').and_return(flexmock())
flexmock(module).should_receive('_make_check_flags').and_return(()) flexmock(module).should_receive('_make_check_flags').and_return(())
insert_subprocess_mock( insert_subprocess_mock(
('borg', 'check', 'repo', '--verbose'), ('borg', 'check', 'repo', '--debug'),
stdout=None, stderr=STDOUT, stdout=None, stderr=STDOUT,
) )
insert_platform_mock() insert_platform_mock()

View file

@ -1,7 +1,7 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
VERSION = '1.0.2' VERSION = '1.0.3'
setup( setup(

View file

@ -5,4 +5,4 @@ skipsdist=True
[testenv] [testenv]
usedevelop=True usedevelop=True
deps=-rtest_requirements.txt deps=-rtest_requirements.txt
commands = py.test [] commands = py.test borgmatic []