瀏覽代碼

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

Dan Helfman 9 年之前
父節點
當前提交
a45d7bec81
共有 5 個文件被更改,包括 24 次插入20 次删除
  1. 4 0
      NEWS
  2. 6 6
      borgmatic/borg.py
  3. 12 12
      borgmatic/tests/unit/test_borg.py
  4. 1 1
      setup.py
  5. 1 1
      tox.ini

+ 4 - 0
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.

+ 6 - 6
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 = (

+ 12 - 12
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()

+ 1 - 1
setup.py

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

+ 1 - 1
tox.ini

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