From 6bfe524bac6d0a1fd4b3091da964af900eb2d2cb Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Thu, 23 Jun 2016 07:13:25 -0700 Subject: [PATCH] #21: Fix for verbosity flag not actually causing verbose output. --- NEWS | 4 ++++ borgmatic/borg.py | 12 ++++++------ borgmatic/tests/unit/test_borg.py | 24 ++++++++++++------------ setup.py | 2 +- tox.ini | 2 +- 5 files changed, 24 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 25d95fd..2cb9b09 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.0.3 + + * #21: Fix for verbosity flag not actually causing verbose output. + 1.0.2 * #20: Fix for traceback when remote_path option is missing. diff --git a/borgmatic/borg.py b/borgmatic/borg.py index 27c570a..f4c5ba9 100644 --- a/borgmatic/borg.py +++ b/borgmatic/borg.py @@ -41,8 +41,8 @@ def create_archive( one_file_system_flags = ('--one-file-system',) if one_file_system else () remote_path_flags = ('--remote-path', remote_path) if remote_path else () verbosity_flags = { - VERBOSITY_SOME: ('--stats',), - VERBOSITY_LOTS: ('--verbose', '--stats'), + VERBOSITY_SOME: ('--info', '--stats',), + VERBOSITY_LOTS: ('--debug', '--list', '--stats'), }.get(verbosity, ()) 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 () verbosity_flags = { - VERBOSITY_SOME: ('--stats',), - VERBOSITY_LOTS: ('--verbose', '--stats'), + VERBOSITY_SOME: ('--info', '--stats',), + VERBOSITY_LOTS: ('--debug', '--stats'), }.get(verbosity, ()) 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 () verbosity_flags = { - VERBOSITY_SOME: ('--verbose',), - VERBOSITY_LOTS: ('--verbose',), + VERBOSITY_SOME: ('--info',), + VERBOSITY_LOTS: ('--debug',), }.get(verbosity, ()) full_command = ( diff --git a/borgmatic/tests/unit/test_borg.py b/borgmatic/tests/unit/test_borg.py index 0511357..1d146ba 100644 --- a/borgmatic/tests/unit/test_borg.py +++ b/borgmatic/tests/unit/test_borg.py @@ -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(): - insert_subprocess_mock(CREATE_COMMAND + ('--stats',)) +def test_create_archive_with_verbosity_some_should_call_borg_with_info_parameter(): + insert_subprocess_mock(CREATE_COMMAND + ('--info', '--stats',)) insert_platform_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(): - insert_subprocess_mock(CREATE_COMMAND + ('--verbose', '--stats')) +def test_create_archive_with_verbosity_lots_should_call_borg_with_debug_parameter(): + insert_subprocess_mock(CREATE_COMMAND + ('--debug', '--list', '--stats')) insert_platform_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() flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return( BASE_PRUNE_FLAGS, ) - insert_subprocess_mock(PRUNE_COMMAND + ('--stats',)) + insert_subprocess_mock(PRUNE_COMMAND + ('--info', '--stats',)) module.prune_archives( 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() flexmock(module).should_receive('_make_prune_flags').with_args(retention_config).and_return( BASE_PRUNE_FLAGS, ) - insert_subprocess_mock(PRUNE_COMMAND + ('--verbose', '--stats',)) + insert_subprocess_mock(PRUNE_COMMAND + ('--debug', '--stats',)) module.prune_archives( 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 flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_make_check_flags').and_return(()) insert_subprocess_mock( - ('borg', 'check', 'repo', '--verbose'), + ('borg', 'check', 'repo', '--info'), stdout=None, stderr=STDOUT, ) 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 flexmock(module).should_receive('_parse_checks').and_return(flexmock()) flexmock(module).should_receive('_make_check_flags').and_return(()) insert_subprocess_mock( - ('borg', 'check', 'repo', '--verbose'), + ('borg', 'check', 'repo', '--debug'), stdout=None, stderr=STDOUT, ) insert_platform_mock() diff --git a/setup.py b/setup.py index 55fa95e..d4dbbbe 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages -VERSION = '1.0.2' +VERSION = '1.0.3' setup( diff --git a/tox.ini b/tox.ini index 64d1f6c..90c5ce2 100644 --- a/tox.ini +++ b/tox.ini @@ -5,4 +5,4 @@ skipsdist=True [testenv] usedevelop=True deps=-rtest_requirements.txt -commands = py.test [] +commands = py.test borgmatic []