Browse Source

Add configuration options for all verbosity and logging flags (#793).

Reviewed-on: https://projects.torsion.org/borgmatic-collective/borgmatic/pulls/1055
Dan Helfman 3 months ago
parent
commit
7ee0d3563b
57 changed files with 937 additions and 686 deletions
  1. 4 2
      NEWS
  2. 1 1
      borgmatic/borg/break_lock.py
  3. 1 1
      borgmatic/borg/change_passphrase.py
  4. 1 1
      borgmatic/borg/check.py
  5. 1 1
      borgmatic/borg/compact.py
  6. 1 1
      borgmatic/borg/create.py
  7. 1 1
      borgmatic/borg/delete.py
  8. 1 1
      borgmatic/borg/export_key.py
  9. 1 1
      borgmatic/borg/export_tar.py
  10. 2 2
      borgmatic/borg/extract.py
  11. 1 1
      borgmatic/borg/import_key.py
  12. 1 1
      borgmatic/borg/info.py
  13. 1 1
      borgmatic/borg/list.py
  14. 1 1
      borgmatic/borg/mount.py
  15. 1 1
      borgmatic/borg/prune.py
  16. 1 1
      borgmatic/borg/recreate.py
  17. 1 1
      borgmatic/borg/repo_create.py
  18. 1 1
      borgmatic/borg/repo_delete.py
  19. 1 1
      borgmatic/borg/repo_info.py
  20. 2 2
      borgmatic/borg/repo_list.py
  21. 1 1
      borgmatic/borg/transfer.py
  22. 9 45
      borgmatic/commands/arguments.py
  23. 55 23
      borgmatic/commands/borgmatic.py
  24. 76 8
      borgmatic/config/schema.yaml
  25. 6 2
      borgmatic/hooks/monitoring/logs.py
  26. 25 0
      borgmatic/verbosity.py
  27. 4 3
      docs/how-to/backup-your-databases.md
  28. 18 3
      docs/how-to/inspect-your-backups.md
  29. 14 2
      docs/how-to/monitor-your-backups.md
  30. 6 60
      tests/integration/commands/test_arguments.py
  31. 11 3
      tests/integration/hooks/monitoring/test_apprise.py
  32. 11 2
      tests/integration/hooks/monitoring/test_healthchecks.py
  33. 11 11
      tests/unit/borg/test_break_lock.py
  34. 17 14
      tests/unit/borg/test_change_passphrase.py
  35. 27 27
      tests/unit/borg/test_check.py
  36. 16 16
      tests/unit/borg/test_compact.py
  37. 36 35
      tests/unit/borg/test_create.py
  38. 13 13
      tests/unit/borg/test_delete.py
  39. 19 19
      tests/unit/borg/test_export_key.py
  40. 17 17
      tests/unit/borg/test_export_tar.py
  41. 33 33
      tests/unit/borg/test_extract.py
  42. 17 17
      tests/unit/borg/test_import_key.py
  43. 23 23
      tests/unit/borg/test_info.py
  44. 27 27
      tests/unit/borg/test_list.py
  45. 17 17
      tests/unit/borg/test_mount.py
  46. 17 17
      tests/unit/borg/test_prune.py
  47. 24 24
      tests/unit/borg/test_recreate.py
  48. 23 23
      tests/unit/borg/test_repo_create.py
  49. 13 13
      tests/unit/borg/test_repo_delete.py
  50. 15 15
      tests/unit/borg/test_repo_info.py
  51. 31 31
      tests/unit/borg/test_repo_list.py
  52. 19 19
      tests/unit/borg/test_transfer.py
  53. 174 77
      tests/unit/commands/test_borgmatic.py
  54. 5 12
      tests/unit/hooks/monitoring/test_healthchecks.py
  55. 14 1
      tests/unit/hooks/monitoring/test_logs.py
  56. 3 10
      tests/unit/hooks/monitoring/test_pagerduty.py
  57. 65 0
      tests/unit/test_verbosity.py

+ 4 - 2
NEWS

@@ -1,7 +1,7 @@
 2.0.0.dev0
 2.0.0.dev0
  * TL;DR: More flexible, completely revamped command hooks. All config options settable on the
  * TL;DR: More flexible, completely revamped command hooks. All config options settable on the
-   command-line. Config option defaults for many command-line flags. New "key import" and "recreate"
-   actions. Almost everything is backwards compatible.
+   command-line. Config option defaults for many command-line flags (including verbosity!). New "key
+   import" and "recreate" actions. Almost everything is backwards compatible.
  * #262: Add a "default_actions" option that supports disabling default actions when borgmatic is
  * #262: Add a "default_actions" option that supports disabling default actions when borgmatic is
    run without any command-line arguments.
    run without any command-line arguments.
  * #303: Deprecate the "--override" flag in favor of direct command-line flags for every borgmatic
  * #303: Deprecate the "--override" flag in favor of direct command-line flags for every borgmatic
@@ -23,6 +23,8 @@
    preparation commands—even when something goes wrong.
    preparation commands—even when something goes wrong.
  * #790: BREAKING: Run all command hooks (both new and deprecated) respecting the
  * #790: BREAKING: Run all command hooks (both new and deprecated) respecting the
    "working_directory" option if configured, meaning that hook commands are run in that directory.
    "working_directory" option if configured, meaning that hook commands are run in that directory.
+ * #793: Add configuration options for all verbosity and logging flags, so you don't have to set
+   them on the command-line.
  * #836: Add a custom command option for the SQLite hook.
  * #836: Add a custom command option for the SQLite hook.
  * #837: Add custom command options for the MongoDB hook.
  * #837: Add custom command options for the MongoDB hook.
  * #1010: When using Borg 2, don't pass the "--stats" flag to "borg prune".
  * #1010: When using Borg 2, don't pass the "--stats" flag to "borg prune".

+ 1 - 1
borgmatic/borg/break_lock.py

@@ -27,7 +27,7 @@ def break_lock(
         (local_path, 'break-lock')
         (local_path, 'break-lock')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/change_passphrase.py

@@ -30,7 +30,7 @@ def change_passphrase(
         (local_path, 'key', 'change-passphrase')
         (local_path, 'key', 'change-passphrase')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/check.py

@@ -167,7 +167,7 @@ def check_archives(
             + make_check_name_flags(checks_subset, archive_filter_flags)
             + make_check_name_flags(checks_subset, archive_filter_flags)
             + (('--remote-path', remote_path) if remote_path else ())
             + (('--remote-path', remote_path) if remote_path else ())
             + (('--umask', str(umask)) if umask else ())
             + (('--umask', str(umask)) if umask else ())
-            + (('--log-json',) if global_arguments.log_json else ())
+            + (('--log-json',) if config.get('log_json') else ())
             + (('--lock-wait', str(lock_wait)) if lock_wait else ())
             + (('--lock-wait', str(lock_wait)) if lock_wait else ())
             + verbosity_flags
             + verbosity_flags
             + (('--progress',) if config.get('progress') else ())
             + (('--progress',) if config.get('progress') else ())

+ 1 - 1
borgmatic/borg/compact.py

@@ -30,7 +30,7 @@ def compact_segments(
         (local_path, 'compact')
         (local_path, 'compact')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--progress',) if config.get('progress') else ())
         + (('--progress',) if config.get('progress') else ())
         + (('--cleanup-commits',) if cleanup_commits else ())
         + (('--cleanup-commits',) if cleanup_commits else ())

+ 1 - 1
borgmatic/borg/create.py

@@ -287,7 +287,7 @@ def make_base_create_command(
         + (('--files-cache', files_cache) if files_cache else ())
         + (('--files-cache', files_cache) if files_cache else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (
         + (
             ('--list', '--filter', list_filter_flags)
             ('--list', '--filter', list_filter_flags)

+ 1 - 1
borgmatic/borg/delete.py

@@ -32,7 +32,7 @@ def make_delete_command(
         + borgmatic.borg.flags.make_flags('dry-run', global_arguments.dry_run)
         + borgmatic.borg.flags.make_flags('dry-run', global_arguments.dry_run)
         + borgmatic.borg.flags.make_flags('remote-path', remote_path)
         + borgmatic.borg.flags.make_flags('remote-path', remote_path)
         + borgmatic.borg.flags.make_flags('umask', config.get('umask'))
         + borgmatic.borg.flags.make_flags('umask', config.get('umask'))
-        + borgmatic.borg.flags.make_flags('log-json', global_arguments.log_json)
+        + borgmatic.borg.flags.make_flags('log-json', config.get('log_json'))
         + borgmatic.borg.flags.make_flags('lock-wait', config.get('lock_wait'))
         + borgmatic.borg.flags.make_flags('lock-wait', config.get('lock_wait'))
         + borgmatic.borg.flags.make_flags('list', config.get('list_details'))
         + borgmatic.borg.flags.make_flags('list', config.get('list_details'))
         + (
         + (

+ 1 - 1
borgmatic/borg/export_key.py

@@ -46,7 +46,7 @@ def export_key(
         (local_path, 'key', 'export')
         (local_path, 'key', 'export')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/export_tar.py

@@ -39,7 +39,7 @@ def export_tar_archive(
         (local_path, 'export-tar')
         (local_path, 'export-tar')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--list',) if config.get('list_details') else ())
         + (('--list',) if config.get('list_details') else ())

+ 2 - 2
borgmatic/borg/extract.py

@@ -47,7 +47,7 @@ def extract_last_archive_dry_run(
     full_extract_command = (
     full_extract_command = (
         (local_path, 'extract', '--dry-run')
         (local_path, 'extract', '--dry-run')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + verbosity_flags
         + verbosity_flags
         + list_flag
         + list_flag
@@ -121,7 +121,7 @@ def extract_archive(
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + numeric_ids_flags
         + numeric_ids_flags
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--list', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--list', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/import_key.py

@@ -43,7 +43,7 @@ def import_key(
         (local_path, 'key', 'import')
         (local_path, 'key', 'import')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/info.py

@@ -37,7 +37,7 @@ def make_info_command(
         )
         )
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + (
         + (
             (
             (

+ 1 - 1
borgmatic/borg/list.py

@@ -48,7 +48,7 @@ def make_list_command(
         )
         )
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags_from_arguments(list_arguments, excludes=MAKE_FLAGS_EXCLUDES)
         + flags.make_flags_from_arguments(list_arguments, excludes=MAKE_FLAGS_EXCLUDES)
         + (
         + (

+ 1 - 1
borgmatic/borg/mount.py

@@ -30,7 +30,7 @@ def mount_archive(
         (local_path, 'mount')
         (local_path, 'mount')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/prune.py

@@ -73,7 +73,7 @@ def prune_archives(
         + make_prune_flags(config, prune_arguments, local_borg_version)
         + make_prune_flags(config, prune_arguments, local_borg_version)
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (
         + (
             ('--stats',)
             ('--stats',)

+ 1 - 1
borgmatic/borg/recreate.py

@@ -43,7 +43,7 @@ def recreate_archive(
     recreate_command = (
     recreate_command = (
         (local_path, 'recreate')
         (local_path, 'recreate')
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait is not None else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait is not None else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())

+ 1 - 1
borgmatic/borg/repo_create.py

@@ -82,7 +82,7 @@ def create_repository(
         + (('--make-parent-dirs',) if make_parent_directories else ())
         + (('--make-parent-dirs',) if make_parent_directories else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--info',) if logger.getEffectiveLevel() == logging.INFO else ())
         + (('--debug',) if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug',) if logger.isEnabledFor(logging.DEBUG) else ())
-        + (('--log-json',) if global_arguments.log_json else ())
+        + (('--log-json',) if config.get('log_json') else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--lock-wait', str(lock_wait)) if lock_wait else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--remote-path', remote_path) if remote_path else ())
         + (('--umask', str(umask)) if umask else ())
         + (('--umask', str(umask)) if umask else ())

+ 1 - 1
borgmatic/borg/repo_delete.py

@@ -37,7 +37,7 @@ def make_repo_delete_command(
         + borgmatic.borg.flags.make_flags('dry-run', global_arguments.dry_run)
         + borgmatic.borg.flags.make_flags('dry-run', global_arguments.dry_run)
         + borgmatic.borg.flags.make_flags('remote-path', remote_path)
         + borgmatic.borg.flags.make_flags('remote-path', remote_path)
         + borgmatic.borg.flags.make_flags('umask', config.get('umask'))
         + borgmatic.borg.flags.make_flags('umask', config.get('umask'))
-        + borgmatic.borg.flags.make_flags('log-json', global_arguments.log_json)
+        + borgmatic.borg.flags.make_flags('log-json', config.get('log_json'))
         + borgmatic.borg.flags.make_flags('lock-wait', config.get('lock_wait'))
         + borgmatic.borg.flags.make_flags('lock-wait', config.get('lock_wait'))
         + borgmatic.borg.flags.make_flags('list', config.get('list_details'))
         + borgmatic.borg.flags.make_flags('list', config.get('list_details'))
         + (
         + (

+ 1 - 1
borgmatic/borg/repo_info.py

@@ -44,7 +44,7 @@ def display_repository_info(
         )
         )
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', lock_wait)
         + flags.make_flags('lock-wait', lock_wait)
         + (('--json',) if repo_info_arguments.json else ())
         + (('--json',) if repo_info_arguments.json else ())
         + flags.make_repository_flags(repository_path, local_borg_version)
         + flags.make_repository_flags(repository_path, local_borg_version)

+ 2 - 2
borgmatic/borg/repo_list.py

@@ -40,7 +40,7 @@ def resolve_archive_name(
         )
         )
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('last', 1)
         + flags.make_flags('last', 1)
         + ('--short',)
         + ('--short',)
@@ -102,7 +102,7 @@ def make_repo_list_command(
         )
         )
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + (
         + (
             (
             (

+ 1 - 1
borgmatic/borg/transfer.py

@@ -31,7 +31,7 @@ def transfer_archives(
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + (('--debug', '--show-rc') if logger.isEnabledFor(logging.DEBUG) else ())
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('remote-path', remote_path)
         + flags.make_flags('umask', config.get('umask'))
         + flags.make_flags('umask', config.get('umask'))
-        + flags.make_flags('log-json', global_arguments.log_json)
+        + flags.make_flags('log-json', config.get('log_json'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('lock-wait', config.get('lock_wait'))
         + flags.make_flags('progress', config.get('progress'))
         + flags.make_flags('progress', config.get('progress'))
         + (
         + (

+ 9 - 45
borgmatic/commands/arguments.py

@@ -526,6 +526,14 @@ def add_arguments_from_schema(arguments_group, schema, unparsed_arguments, names
             default=None,
             default=None,
             help=f'Set the --{flag_name} value to false.',
             help=f'Set the --{flag_name} value to false.',
         )
         )
+    elif flag_name == 'verbosity':
+        arguments_group.add_argument(
+            '-v',
+            '--verbosity',
+            type=argument_type,
+            metavar=metavar,
+            help=description,
+        )
     else:
     else:
         arguments_group.add_argument(
         arguments_group.add_argument(
             f'--{flag_name}',
             f'--{flag_name}',
@@ -568,56 +576,12 @@ def make_parsers(schema, unparsed_arguments):
         action='store_true',
         action='store_true',
         help='Go through the motions, but do not actually write to any repositories',
         help='Go through the motions, but do not actually write to any repositories',
     )
     )
-    global_group.add_argument(
-        '-v',
-        '--verbosity',
-        type=int,
-        choices=range(-2, 3),
-        default=0,
-        help='Display verbose progress to the console: -2 (disabled), -1 (errors only), 0 (responses to actions, the default), 1 (info about steps borgmatic is taking), or 2 (debug)',
-    )
-    global_group.add_argument(
-        '--syslog-verbosity',
-        type=int,
-        choices=range(-2, 3),
-        default=-2,
-        help='Log verbose progress to syslog: -2 (disabled, the default), -1 (errors only), 0 (responses to actions), 1 (info about steps borgmatic is taking), or 2 (debug)',
-    )
-    global_group.add_argument(
-        '--log-file-verbosity',
-        type=int,
-        choices=range(-2, 3),
-        default=1,
-        help='When --log-file is given, log verbose progress to file: -2 (disabled), -1 (errors only), 0 (responses to actions), 1 (info about steps borgmatic is taking, the default), or 2 (debug)',
-    )
-    global_group.add_argument(
-        '--monitoring-verbosity',
-        type=int,
-        choices=range(-2, 3),
-        default=1,
-        help='When a monitoring integration supporting logging is configured, log verbose progress to it: -2 (disabled), -1 (errors only), responses to actions (0), 1 (info about steps borgmatic is taking, the default), or 2 (debug)',
-    )
-    global_group.add_argument(
-        '--log-file',
-        type=str,
-        help='Write log messages to this file instead of syslog',
-    )
-    global_group.add_argument(
-        '--log-file-format',
-        type=str,
-        help='Python format string used for log messages written to the log file',
-    )
-    global_group.add_argument(
-        '--log-json',
-        action='store_true',
-        help='Write Borg log messages and console output as one JSON object per log line instead of formatted text',
-    )
     global_group.add_argument(
     global_group.add_argument(
         '--override',
         '--override',
         metavar='OPTION.SUBOPTION=VALUE',
         metavar='OPTION.SUBOPTION=VALUE',
         dest='overrides',
         dest='overrides',
         action='append',
         action='append',
-        help='Configuration file option to override with specified value, see documentation for overriding list or key/value options, can specify flag multiple times',
+        help='Deprecated. Configuration file option to override with specified value, see documentation for overriding list or key/value options, can specify flag multiple times',
     )
     )
     global_group.add_argument(
     global_group.add_argument(
         '--no-environment-interpolation',
         '--no-environment-interpolation',

+ 55 - 23
borgmatic/commands/borgmatic.py

@@ -54,7 +54,7 @@ from borgmatic.logger import (
     should_do_markup,
     should_do_markup,
 )
 )
 from borgmatic.signals import configure_signals
 from borgmatic.signals import configure_signals
-from borgmatic.verbosity import verbosity_to_log_level
+from borgmatic.verbosity import get_verbosity, verbosity_to_log_level
 
 
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 
 
@@ -95,7 +95,7 @@ class Monitoring_hooks:
         self.config_filename = config_filename
         self.config_filename = config_filename
         self.config = config
         self.config = config
         self.dry_run = global_arguments.dry_run
         self.dry_run = global_arguments.dry_run
-        self.monitoring_log_level = verbosity_to_log_level(global_arguments.monitoring_verbosity)
+        self.monitoring_log_level = verbosity_to_log_level(config.get('monitoring_verbosity'))
         self.monitoring_hooks_are_activated = (
         self.monitoring_hooks_are_activated = (
             using_primary_action and self.monitoring_log_level != DISABLED
             using_primary_action and self.monitoring_log_level != DISABLED
         )
         )
@@ -217,7 +217,7 @@ def run_configuration(config_filename, config, config_paths, arguments):
                 dry_run=global_arguments.dry_run,
                 dry_run=global_arguments.dry_run,
                 action_names=arguments.keys(),
                 action_names=arguments.keys(),
                 configuration_filename=config_filename,
                 configuration_filename=config_filename,
-                log_file=arguments['global'].log_file or '',
+                log_file=config.get('log_file', ''),
             ):
             ):
                 try:
                 try:
                     local_borg_version = borg_version.local_borg_version(config, local_path)
                     local_borg_version = borg_version.local_borg_version(config, local_path)
@@ -296,7 +296,7 @@ def run_configuration(config_filename, config, config_paths, arguments):
             borgmatic.config.paths.get_working_directory(config),
             borgmatic.config.paths.get_working_directory(config),
             global_arguments.dry_run,
             global_arguments.dry_run,
             configuration_filename=config_filename,
             configuration_filename=config_filename,
-            log_file=arguments['global'].log_file or '',
+            log_file=config.get('log_file', ''),
             repository=error_repository.get('path', '') if error_repository else '',
             repository=error_repository.get('path', '') if error_repository else '',
             repository_label=error_repository.get('label', '') if error_repository else '',
             repository_label=error_repository.get('label', '') if error_repository else '',
             error=encountered_error,
             error=encountered_error,
@@ -339,7 +339,7 @@ def run_actions(
     hook_context = {
     hook_context = {
         'configuration_filename': config_filename,
         'configuration_filename': config_filename,
         'repository_label': repository.get('label', ''),
         'repository_label': repository.get('label', ''),
-        'log_file': global_arguments.log_file if global_arguments.log_file else '',
+        'log_file': config.get('log_file', ''),
         # Deprecated: For backwards compatibility with borgmatic < 1.6.0.
         # Deprecated: For backwards compatibility with borgmatic < 1.6.0.
         'repositories': ','.join([repo['path'] for repo in config['repositories']]),
         'repositories': ','.join([repo['path'] for repo in config['repositories']]),
         'repository': repository_path,
         'repository': repository_path,
@@ -848,12 +848,12 @@ def collect_highlander_action_summary_logs(configs, arguments, configuration_par
         return
         return
 
 
 
 
-def collect_configuration_run_summary_logs(configs, config_paths, arguments):
+def collect_configuration_run_summary_logs(configs, config_paths, arguments, log_file_path):
     '''
     '''
     Given a dict of configuration filename to corresponding parsed configuration, a sequence of
     Given a dict of configuration filename to corresponding parsed configuration, a sequence of
-    loaded configuration paths, and parsed command-line arguments as a dict from subparser name to a
-    parsed namespace of arguments, run each configuration file and yield a series of
-    logging.LogRecord instances containing summary information about each run.
+    loaded configuration paths, parsed command-line arguments as a dict from subparser name to a
+    parsed namespace of arguments, and the path of a log file (if any), run each configuration file
+    and yield a series of logging.LogRecord instances containing summary information about each run.
 
 
     As a side effect of running through these configuration files, output their JSON results, if
     As a side effect of running through these configuration files, output their JSON results, if
     any, to stdout.
     any, to stdout.
@@ -888,7 +888,7 @@ def collect_configuration_run_summary_logs(configs, config_paths, arguments):
                 borgmatic.config.paths.get_working_directory(config),
                 borgmatic.config.paths.get_working_directory(config),
                 arguments['global'].dry_run,
                 arguments['global'].dry_run,
                 configuration_filename=config_filename,
                 configuration_filename=config_filename,
-                log_file=arguments['global'].log_file or '',
+                log_file=log_file_path or '',
             )
             )
     except (CalledProcessError, ValueError, OSError) as error:
     except (CalledProcessError, ValueError, OSError) as error:
         yield from log_error_records('Error running before everything hook', error)
         yield from log_error_records('Error running before everything hook', error)
@@ -943,7 +943,7 @@ def collect_configuration_run_summary_logs(configs, config_paths, arguments):
                 borgmatic.config.paths.get_working_directory(config),
                 borgmatic.config.paths.get_working_directory(config),
                 arguments['global'].dry_run,
                 arguments['global'].dry_run,
                 configuration_filename=config_filename,
                 configuration_filename=config_filename,
-                log_file=arguments['global'].log_file or '',
+                log_file=log_file_path or '',
             )
             )
     except (CalledProcessError, ValueError, OSError) as error:
     except (CalledProcessError, ValueError, OSError) as error:
         yield from log_error_records('Error running after everything hook', error)
         yield from log_error_records('Error running after everything hook', error)
@@ -960,9 +960,9 @@ def exit_with_help_link():  # pragma: no cover
 
 
 def check_and_show_help_on_no_args(configs):
 def check_and_show_help_on_no_args(configs):
     '''
     '''
-    Check if the borgmatic command is run without any arguments. If the configuration option
-    "default_actions" is set to False, show the help message. Otherwise, trigger the default backup
-    behavior.
+    Given a dict of configuration filename to corresponding parsed configuration, check if the
+    borgmatic command is run without any arguments. If the configuration option "default_actions" is
+    set to False, show the help message. Otherwise, trigger the default backup behavior.
     '''
     '''
     if len(sys.argv) == 1:  # No arguments provided
     if len(sys.argv) == 1:  # No arguments provided
         default_actions = any(config.get('default_actions', True) for config in configs.values())
         default_actions = any(config.get('default_actions', True) for config in configs.values())
@@ -971,6 +971,34 @@ def check_and_show_help_on_no_args(configs):
             sys.exit(0)
             sys.exit(0)
 
 
 
 
+def get_singular_option_value(configs, option_name):
+    '''
+    Given a dict of configuration filename to corresponding parsed configuration, return the value
+    of the given option from the configuration files or None if it's not set.
+
+    Log and exit if there are conflicting values for the option across the configuration files.
+    '''
+    distinct_values = {
+        value
+        for config in configs.values()
+        for value in (config.get(option_name),)
+        if value is not None
+    }
+
+    if len(distinct_values) > 1:
+        configure_logging(logging.CRITICAL)
+        joined_values = ', '.join(str(value) for value in distinct_values)
+        logger.critical(
+            f'The {option_name} option has conflicting values across configuration files: {joined_values}'
+        )
+        exit_with_help_link()
+
+    try:
+        return tuple(distinct_values)[0]
+    except IndexError:
+        return None
+
+
 def main(extra_summary_logs=[]):  # pragma: no cover
 def main(extra_summary_logs=[]):  # pragma: no cover
     configure_signals()
     configure_signals()
     configure_delayed_logging()
     configure_delayed_logging()
@@ -1025,17 +1053,17 @@ def main(extra_summary_logs=[]):  # pragma: no cover
     any_json_flags = any(
     any_json_flags = any(
         getattr(sub_arguments, 'json', False) for sub_arguments in arguments.values()
         getattr(sub_arguments, 'json', False) for sub_arguments in arguments.values()
     )
     )
-    color_enabled = should_do_markup(configs, any_json_flags)
+    log_file_path = get_singular_option_value(configs, 'log_file')
 
 
     try:
     try:
         configure_logging(
         configure_logging(
-            verbosity_to_log_level(global_arguments.verbosity),
-            verbosity_to_log_level(global_arguments.syslog_verbosity),
-            verbosity_to_log_level(global_arguments.log_file_verbosity),
-            verbosity_to_log_level(global_arguments.monitoring_verbosity),
-            global_arguments.log_file,
-            global_arguments.log_file_format,
-            color_enabled=color_enabled,
+            verbosity_to_log_level(get_verbosity(configs, 'verbosity')),
+            verbosity_to_log_level(get_verbosity(configs, 'syslog_verbosity')),
+            verbosity_to_log_level(get_verbosity(configs, 'log_file_verbosity')),
+            verbosity_to_log_level(get_verbosity(configs, 'monitoring_verbosity')),
+            log_file_path,
+            get_singular_option_value(configs, 'log_file_format'),
+            color_enabled=should_do_markup(configs, any_json_flags),
         )
         )
     except (FileNotFoundError, PermissionError) as error:
     except (FileNotFoundError, PermissionError) as error:
         configure_logging(logging.CRITICAL)
         configure_logging(logging.CRITICAL)
@@ -1051,7 +1079,11 @@ def main(extra_summary_logs=[]):  # pragma: no cover
                     configs, arguments, configuration_parse_errors
                     configs, arguments, configuration_parse_errors
                 )
                 )
             )
             )
-            or list(collect_configuration_run_summary_logs(configs, config_paths, arguments))
+            or list(
+                collect_configuration_run_summary_logs(
+                    configs, config_paths, arguments, log_file_path
+                )
+            )
         )
         )
     )
     )
     summary_logs_max_level = max(log.levelno for log in summary_logs)
     summary_logs_max_level = max(log.levelno for log in summary_logs)

+ 76 - 8
borgmatic/config/schema.yaml

@@ -815,6 +815,75 @@ properties:
         description: |
         description: |
             Apply color to console output. Defaults to true.
             Apply color to console output. Defaults to true.
         example: false
         example: false
+    verbosity:
+        type: integer
+        enum:
+            - -2
+            - -1
+            - 0
+            - 1
+            - 2
+        description: |
+            Display verbose output to the console: -2 (disabled), -1 (errors
+            only), 0 (warnings and responses to actions, the default), 1 (info
+            about steps borgmatic is taking), or 2 (debug).
+        example: 2
+    syslog_verbosity:
+        type: integer
+        enum:
+            - -2
+            - -1
+            - 0
+            - 1
+            - 2
+        description: |
+            Log verbose output to syslog: -2 (disabled, the default), -1 (errors
+            only), 0 (warnings and responses to actions), 1 (info about steps
+            borgmatic is taking), or 2 (debug).
+        example: 2
+    log_file_verbosity:
+        type: integer
+        enum:
+            - -2
+            - -1
+            - 0
+            - 1
+            - 2
+        description: |
+            Log verbose output to file: -2 (disabled), -1 (errors only), 0
+            (warnings and responses to actions), 1 (info about steps borgmatic
+            is taking, the default), or 2 (debug).
+        example: 2
+    log_file:
+        type: string
+        description: |
+            Write log messages to the file at this path.
+        example: /var/log/borgmatic/logfile.txt
+    log_file_format:
+        type: string
+        description: |
+            Python format string used for log messages written to the log file.
+        example: "[{asctime}] {levelname}: {prefix}{message}"
+    monitoring_verbosity:
+        type: integer
+        enum:
+            - -2
+            - -1
+            - 0
+            - 1
+            - 2
+        description: |
+            When a monitoring integration supporting logging is configured, log
+            verbose output to it: -2 (disabled), -1 (errors only), 0 (warnings
+            and responses to actions), 1 (info about steps borgmatic is taking,
+            the default), or 2 (debug).
+        example: 2
+    log_json:
+        type: boolean
+        description: |
+            Write Borg log messages and console output as one JSON object per
+            log line instead of formatted text. Defaults to false.
+        example: true
     progress:
     progress:
         type: boolean
         type: boolean
         description: |
         description: |
@@ -836,6 +905,13 @@ properties:
             running supported actions. Corresponds to the "--list" flag on those
             running supported actions. Corresponds to the "--list" flag on those
             actions. Defaults to false.
             actions. Defaults to false.
         example: true
         example: true
+    default_actions:
+        type: boolean
+        description: |
+            Whether to apply default actions (create, prune, compact and check)
+            when no arguments are supplied to the borgmatic command. If set to
+            false, borgmatic displays the help message instead.
+        example: true
     skip_actions:
     skip_actions:
         type: array
         type: array
         items:
         items:
@@ -2806,11 +2882,3 @@ properties:
                 example: "1:7370001"
                 example: "1:7370001"
         description: |
         description: |
             Configuration for integration with the KeePassXC password manager.
             Configuration for integration with the KeePassXC password manager.
-    default_actions:
-        type: boolean
-        description: |
-            Whether to apply default actions (e.g., backup) when no arguments
-            are supplied to the borgmatic command. If set to true, borgmatic
-            triggers the default actions (create, prune, compact and check). If
-            set to false, borgmatic displays the help message instead.
-        example: true

+ 6 - 2
borgmatic/hooks/monitoring/logs.py

@@ -38,11 +38,13 @@ class Forgetful_buffering_handler(logging.Handler):
             self.forgot = True
             self.forgot = True
 
 
 
 
-def add_handler(handler):  # pragma: no cover
+def add_handler(handler):
     '''
     '''
     Add the given handler to the global logger.
     Add the given handler to the global logger.
     '''
     '''
-    logging.getLogger().addHandler(handler)
+    logger = logging.getLogger()
+    logger.addHandler(handler)
+    logger.setLevel(min(handler.level for handler in logger.handlers))
 
 
 
 
 def get_handler(identifier):
 def get_handler(identifier):
@@ -90,3 +92,5 @@ def remove_handler(identifier):
         logger.removeHandler(get_handler(identifier))
         logger.removeHandler(get_handler(identifier))
     except ValueError:
     except ValueError:
         pass
         pass
+
+    logger.setLevel(min(handler.level for handler in logger.handlers))

+ 25 - 0
borgmatic/verbosity.py

@@ -22,3 +22,28 @@ def verbosity_to_log_level(verbosity):
         VERBOSITY_SOME: logging.INFO,
         VERBOSITY_SOME: logging.INFO,
         VERBOSITY_LOTS: logging.DEBUG,
         VERBOSITY_LOTS: logging.DEBUG,
     }.get(verbosity, logging.WARNING)
     }.get(verbosity, logging.WARNING)
+
+
+DEFAULT_VERBOSITIES = {
+    'verbosity': 0,
+    'syslog_verbosity': -2,
+    'log_file_verbosity': 1,
+    'monitoring_verbosity': 1,
+}
+
+
+def get_verbosity(configs, option_name):
+    '''
+    Given a dict from configuration filename to configuration dict, and the name of a configuration
+    verbosity option, return the maximum verbosity value from that option across the given
+    configuration files.
+    '''
+    try:
+        return max(
+            verbosity
+            for config in configs.values()
+            for verbosity in (config.get(option_name, DEFAULT_VERBOSITIES[option_name]),)
+            if verbosity is not None
+        )
+    except ValueError:
+        return DEFAULT_VERBOSITIES[option_name]

+ 4 - 3
docs/how-to/backup-your-databases.md

@@ -645,9 +645,10 @@ With PostgreSQL, MariaDB, and MySQL, if you're getting authentication errors
 when borgmatic tries to connect to your database, a natural reaction is to
 when borgmatic tries to connect to your database, a natural reaction is to
 increase your borgmatic verbosity with `--verbosity 2` and go looking in the
 increase your borgmatic verbosity with `--verbosity 2` and go looking in the
 logs. You'll notice though that your database password does not show up in the
 logs. You'll notice though that your database password does not show up in the
-logs. But this is likely not the cause of the authentication problem unless
-you mistyped your password; borgmatic passes your password to the database via
-an environment variable that does not appear in the logs.
+logs. But this is likely not the cause of the authentication problem unless you
+mistyped your password; borgmatic passes your password to the database via an
+environment variable or anonymous pipe, so the password does not appear in the
+logs.
 
 
 The cause of an authentication error is often on the database side—in the
 The cause of an authentication error is often on the database side—in the
 configuration of which users are allowed to connect and how they are
 configuration of which users are allowed to connect and how they are

+ 18 - 3
docs/how-to/inspect-your-backups.md

@@ -7,9 +7,9 @@ eleventyNavigation:
 ---
 ---
 ## Backup progress
 ## Backup progress
 
 
-By default, borgmatic runs proceed silently except in the case of errors. But
-if you'd like to to get additional information about the progress of the
-backup as it proceeds, use the verbosity option:
+By default, borgmatic runs proceed silently except in the case of warnings or
+errors. But if you'd like to to get additional information about the progress of
+the backup as it proceeds, use the verbosity option:
 
 
 ```bash
 ```bash
 borgmatic --verbosity 1
 borgmatic --verbosity 1
@@ -32,6 +32,9 @@ The full set of verbosity levels are:
  * `1`: some additional output (informational level)
  * `1`: some additional output (informational level)
  * `2`: lots of additional output (debug level)
  * `2`: lots of additional output (debug level)
 
 
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+verbosity in your borgmatic configuration via the `verbosity` option.
+
 
 
 ## Backup summary
 ## Backup summary
 
 
@@ -149,6 +152,10 @@ borgmatic --syslog-verbosity 2
 
 
 See above for further details about the verbosity levels.
 See above for further details about the verbosity levels.
 
 
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+syslog verbosity in your borgmatic configuration via the `syslog_verbosity`
+option.
+
 Where these logs show up depends on your particular system. If you're using
 Where these logs show up depends on your particular system. If you're using
 systemd, try running `journalctl -xe`. Otherwise, try viewing
 systemd, try running `journalctl -xe`. Otherwise, try viewing
 `/var/log/syslog` or similar.
 `/var/log/syslog` or similar.
@@ -190,6 +197,10 @@ You can use the `--log-file-verbosity` flag to customize the log file's log leve
 borgmatic --log-file /path/to/file.log --log-file-verbosity 2
 borgmatic --log-file /path/to/file.log --log-file-verbosity 2
 ```
 ```
 
 
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the log
+file verbosity in your borgmatic configuration via the `log_file_verbosity`
+option.
+
 <span class="minilink minilink-addedin">New in version 1.7.11</span> Use the
 <span class="minilink minilink-addedin">New in version 1.7.11</span> Use the
 `--log-file-format` flag to override the default log message format. This
 `--log-file-format` flag to override the default log message format. This
 format string can contain a series of named placeholders wrapped in curly
 format string can contain a series of named placeholders wrapped in curly
@@ -218,3 +229,7 @@ for additional placeholders.
 
 
 Note that this `--log-file-format` flag only applies to the specified
 Note that this `--log-file-format` flag only applies to the specified
 `--log-file` and not to syslog or other logging.
 `--log-file` and not to syslog or other logging.
+
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+defaults for these flags in your borgmatic configuration via the `log_file` and
+`log_file_format` options.

+ 14 - 2
docs/how-to/monitor-your-backups.md

@@ -104,6 +104,10 @@ Additionally, see the [borgmatic configuration
 file](https://torsion.org/borgmatic/docs/reference/configuration/) for
 file](https://torsion.org/borgmatic/docs/reference/configuration/) for
 additional Healthchecks options.
 additional Healthchecks options.
 
 
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+defaults for these flags in your borgmatic configuration via the
+`monitoring_verbosity`, `list`, and `statistics` options.
+
 You can configure Healthchecks to notify you by a [variety of
 You can configure Healthchecks to notify you by a [variety of
 mechanisms](https://healthchecks.io/#welcome-integrations) when backups fail
 mechanisms](https://healthchecks.io/#welcome-integrations) when backups fail
 or it doesn't hear from borgmatic for a certain period of time.
 or it doesn't hear from borgmatic for a certain period of time.
@@ -218,7 +222,11 @@ You can customize the verbosity of the logs that are sent with borgmatic's
 `--monitoring-verbosity` flag. The `--list` and `--stats` flags may also be of
 `--monitoring-verbosity` flag. The `--list` and `--stats` flags may also be of
 use. See `borgmatic create --help` for more information.
 use. See `borgmatic create --help` for more information.
 
 
-If you don't want any logs sent, you can disable this feature by setting
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+defaults for these flags in your borgmatic configuration via the
+`monitoring_verbosity`, `list`, and `statistics` options.
+
+If you don't want any logs sent, you can disable log sending by setting
 `send_logs` to `false`:
 `send_logs` to `false`:
 
 
 ```yaml
 ```yaml
@@ -523,7 +531,11 @@ You can customize the verbosity of the logs that are sent with borgmatic's
 `--monitoring-verbosity` flag. The `--list` and `--stats` flags may also be of
 `--monitoring-verbosity` flag. The `--list` and `--stats` flags may also be of
 use. See `borgmatic create --help` for more information.
 use. See `borgmatic create --help` for more information.
 
 
-If you don't want any logs sent, you can disable this feature by setting
+<span class="minilink minilink-addedin">New in version 2.0.0</span>Set the
+defaults for these flags in your borgmatic configuration via the
+`monitoring_verbosity`, `list`, and `statistics` options.
+
+If you don't want any logs sent, you can disable log sending by setting
 `send_logs` to `false`:
 `send_logs` to `false`:
 
 
 ```yaml
 ```yaml

+ 6 - 60
tests/integration/commands/test_arguments.py

@@ -145,10 +145,6 @@ def test_parse_arguments_with_no_arguments_uses_defaults():
 
 
     global_arguments = arguments['global']
     global_arguments = arguments['global']
     assert global_arguments.config_paths == config_paths
     assert global_arguments.config_paths == config_paths
-    assert global_arguments.verbosity == 0
-    assert global_arguments.syslog_verbosity == -2
-    assert global_arguments.log_file_verbosity == 1
-    assert global_arguments.monitoring_verbosity == 1
 
 
 
 
 def test_parse_arguments_with_multiple_config_flags_parses_as_list():
 def test_parse_arguments_with_multiple_config_flags_parses_as_list():
@@ -158,10 +154,6 @@ def test_parse_arguments_with_multiple_config_flags_parses_as_list():
 
 
     global_arguments = arguments['global']
     global_arguments = arguments['global']
     assert global_arguments.config_paths == ['myconfig', 'otherconfig']
     assert global_arguments.config_paths == ['myconfig', 'otherconfig']
-    assert global_arguments.verbosity == 0
-    assert global_arguments.syslog_verbosity == -2
-    assert global_arguments.log_file_verbosity == 1
-    assert global_arguments.monitoring_verbosity == 1
 
 
 
 
 def test_parse_arguments_with_action_after_config_path_omits_action():
 def test_parse_arguments_with_action_after_config_path_omits_action():
@@ -199,48 +191,6 @@ def test_parse_arguments_with_action_and_positional_arguments_after_config_path_
     assert arguments['borg'].options == ['key', 'export']
     assert arguments['borg'].options == ['key', 'export']
 
 
 
 
-def test_parse_arguments_with_verbosity_overrides_default():
-    config_paths = ['default']
-    flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
-
-    arguments = module.parse_arguments({}, '--verbosity', '1')
-
-    global_arguments = arguments['global']
-    assert global_arguments.config_paths == config_paths
-    assert global_arguments.verbosity == 1
-    assert global_arguments.syslog_verbosity == -2
-    assert global_arguments.log_file_verbosity == 1
-    assert global_arguments.monitoring_verbosity == 1
-
-
-def test_parse_arguments_with_syslog_verbosity_overrides_default():
-    config_paths = ['default']
-    flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
-
-    arguments = module.parse_arguments({}, '--syslog-verbosity', '2')
-
-    global_arguments = arguments['global']
-    assert global_arguments.config_paths == config_paths
-    assert global_arguments.verbosity == 0
-    assert global_arguments.syslog_verbosity == 2
-    assert global_arguments.log_file_verbosity == 1
-    assert global_arguments.monitoring_verbosity == 1
-
-
-def test_parse_arguments_with_log_file_verbosity_overrides_default():
-    config_paths = ['default']
-    flexmock(module.collect).should_receive('get_default_config_paths').and_return(config_paths)
-
-    arguments = module.parse_arguments({}, '--log-file-verbosity', '-1')
-
-    global_arguments = arguments['global']
-    assert global_arguments.config_paths == config_paths
-    assert global_arguments.verbosity == 0
-    assert global_arguments.syslog_verbosity == -2
-    assert global_arguments.log_file_verbosity == -1
-    assert global_arguments.monitoring_verbosity == 1
-
-
 def test_parse_arguments_with_single_override_parses():
 def test_parse_arguments_with_single_override_parses():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
 
 
@@ -320,19 +270,19 @@ def test_parse_arguments_with_help_and_action_shows_action_help(capsys):
 def test_parse_arguments_with_action_before_global_options_parses_options():
 def test_parse_arguments_with_action_before_global_options_parses_options():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
 
 
-    arguments = module.parse_arguments({}, 'prune', '--verbosity', '2')
+    arguments = module.parse_arguments({}, 'prune', '--dry-run')
 
 
     assert 'prune' in arguments
     assert 'prune' in arguments
-    assert arguments['global'].verbosity == 2
+    assert arguments['global'].dry_run
 
 
 
 
 def test_parse_arguments_with_global_options_before_action_parses_options():
 def test_parse_arguments_with_global_options_before_action_parses_options():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
 
 
-    arguments = module.parse_arguments({}, '--verbosity', '2', 'prune')
+    arguments = module.parse_arguments({}, '--dry-run', 'prune')
 
 
     assert 'prune' in arguments
     assert 'prune' in arguments
-    assert arguments['global'].verbosity == 2
+    assert arguments['global'].dry_run
 
 
 
 
 def test_parse_arguments_with_prune_action_leaves_other_actions_disabled():
 def test_parse_arguments_with_prune_action_leaves_other_actions_disabled():
@@ -707,17 +657,13 @@ def test_parse_arguments_config_with_subaction_and_required_flags_does_not_raise
 def test_parse_arguments_config_with_subaction_and_global_flags_at_start_does_not_raise():
 def test_parse_arguments_config_with_subaction_and_global_flags_at_start_does_not_raise():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
 
 
-    module.parse_arguments(
-        {}, '--verbosity', '1', 'config', 'bootstrap', '--repository', 'repo.borg'
-    )
+    module.parse_arguments({}, '--dry-run', 'config', 'bootstrap', '--repository', 'repo.borg')
 
 
 
 
 def test_parse_arguments_config_with_subaction_and_global_flags_at_end_does_not_raise():
 def test_parse_arguments_config_with_subaction_and_global_flags_at_end_does_not_raise():
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
     flexmock(module.collect).should_receive('get_default_config_paths').and_return(['default'])
 
 
-    module.parse_arguments(
-        {}, 'config', 'bootstrap', '--repository', 'repo.borg', '--verbosity', '1'
-    )
+    module.parse_arguments({}, 'config', 'bootstrap', '--repository', 'repo.borg', '--dry-run')
 
 
 
 
 def test_parse_arguments_config_with_subaction_and_explicit_config_file_does_not_raise():
 def test_parse_arguments_config_with_subaction_and_explicit_config_file_does_not_raise():

+ 11 - 3
tests/integration/hooks/monitoring/test_apprise.py

@@ -8,13 +8,17 @@ from borgmatic.hooks.monitoring import apprise as module
 def test_destroy_monitor_removes_apprise_handler():
 def test_destroy_monitor_removes_apprise_handler():
     logger = logging.getLogger()
     logger = logging.getLogger()
     original_handlers = list(logger.handlers)
     original_handlers = list(logger.handlers)
+
+    # Don't mess with the actual log level because it can impact downstream tests.
+    flexmock(logger).should_receive('setLevel')
     module.borgmatic.hooks.monitoring.logs.add_handler(
     module.borgmatic.hooks.monitoring.logs.add_handler(
         module.borgmatic.hooks.monitoring.logs.Forgetful_buffering_handler(
         module.borgmatic.hooks.monitoring.logs.Forgetful_buffering_handler(
             identifier=module.HANDLER_IDENTIFIER, byte_capacity=100, log_level=1
             identifier=module.HANDLER_IDENTIFIER, byte_capacity=100, log_level=1
         )
         )
     )
     )
-
-    module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock())
+    module.destroy_monitor(
+        hook_config=flexmock(), config=flexmock(), monitoring_log_level=1, dry_run=False
+    )
 
 
     assert logger.handlers == original_handlers
     assert logger.handlers == original_handlers
 
 
@@ -23,6 +27,10 @@ def test_destroy_monitor_without_apprise_handler_does_not_raise():
     logger = logging.getLogger()
     logger = logging.getLogger()
     original_handlers = list(logger.handlers)
     original_handlers = list(logger.handlers)
 
 
-    module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock())
+    # Don't mess with the actual log level because it can impact downstream tests.
+    flexmock(logger).should_receive('setLevel')
+    module.destroy_monitor(
+        hook_config=flexmock(), config=flexmock(), monitoring_log_level=1, dry_run=False
+    )
 
 
     assert logger.handlers == original_handlers
     assert logger.handlers == original_handlers

+ 11 - 2
tests/integration/hooks/monitoring/test_healthchecks.py

@@ -8,13 +8,18 @@ from borgmatic.hooks.monitoring import healthchecks as module
 def test_destroy_monitor_removes_healthchecks_handler():
 def test_destroy_monitor_removes_healthchecks_handler():
     logger = logging.getLogger()
     logger = logging.getLogger()
     original_handlers = list(logger.handlers)
     original_handlers = list(logger.handlers)
+
+    # Don't mess with the actual log level because it can impact downstream tests.
+    flexmock(logger).should_receive('setLevel')
     module.borgmatic.hooks.monitoring.logs.add_handler(
     module.borgmatic.hooks.monitoring.logs.add_handler(
         module.borgmatic.hooks.monitoring.logs.Forgetful_buffering_handler(
         module.borgmatic.hooks.monitoring.logs.Forgetful_buffering_handler(
             identifier=module.HANDLER_IDENTIFIER, byte_capacity=100, log_level=1
             identifier=module.HANDLER_IDENTIFIER, byte_capacity=100, log_level=1
         )
         )
     )
     )
 
 
-    module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock())
+    module.destroy_monitor(
+        hook_config=flexmock(), config=flexmock(), monitoring_log_level=1, dry_run=False
+    )
 
 
     assert logger.handlers == original_handlers
     assert logger.handlers == original_handlers
 
 
@@ -23,6 +28,10 @@ def test_destroy_monitor_without_healthchecks_handler_does_not_raise():
     logger = logging.getLogger()
     logger = logging.getLogger()
     original_handlers = list(logger.handlers)
     original_handlers = list(logger.handlers)
 
 
-    module.destroy_monitor(flexmock(), flexmock(), flexmock(), flexmock())
+    # Don't mess with the actual log level because it can impact downstream tests.
+    flexmock(logger).should_receive('setLevel')
+    module.destroy_monitor(
+        hook_config=flexmock(), config=flexmock(), monitoring_log_level=1, dry_run=False
+    )
 
 
     assert logger.handlers == original_handlers
     assert logger.handlers == original_handlers

+ 11 - 11
tests/unit/borg/test_break_lock.py

@@ -29,7 +29,7 @@ def test_break_lock_calls_borg_with_required_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -41,7 +41,7 @@ def test_break_lock_calls_borg_with_local_path():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -54,7 +54,7 @@ def test_break_lock_calls_borg_using_exit_codes():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -67,7 +67,7 @@ def test_break_lock_calls_borg_with_remote_path_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -80,7 +80,7 @@ def test_break_lock_calls_borg_with_umask_flags():
         repository_path='repo',
         repository_path='repo',
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -90,9 +90,9 @@ def test_break_lock_calls_borg_with_log_json_flags():
 
 
     module.break_lock(
     module.break_lock(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -104,7 +104,7 @@ def test_break_lock_calls_borg_with_lock_wait_flags():
         repository_path='repo',
         repository_path='repo',
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -117,7 +117,7 @@ def test_break_lock_with_log_info_calls_borg_with_info_parameter():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -130,7 +130,7 @@ def test_break_lock_with_log_debug_calls_borg_with_debug_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -142,5 +142,5 @@ def test_break_lock_calls_borg_with_working_directory():
         repository_path='repo',
         repository_path='repo',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 17 - 14
tests/unit/borg/test_change_passphrase.py

@@ -41,7 +41,7 @@ def test_change_passphrase_calls_borg_with_required_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -54,7 +54,7 @@ def test_change_passphrase_calls_borg_with_local_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -72,7 +72,7 @@ def test_change_passphrase_calls_borg_using_exit_codes():
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -87,7 +87,7 @@ def test_change_passphrase_calls_borg_with_remote_path_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -104,20 +104,23 @@ def test_change_passphrase_calls_borg_with_umask_flags():
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
 def test_change_passphrase_calls_borg_with_log_json_flags():
 def test_change_passphrase_calls_borg_with_log_json_flags():
     flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
     flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
-    insert_execute_command_mock(('borg', 'key', 'change-passphrase', '--log-json', 'repo'))
+    config = {'log_json': True}
+    insert_execute_command_mock(
+        ('borg', 'key', 'change-passphrase', '--log-json', 'repo'), config=config
+    )
 
 
     module.change_passphrase(
     module.change_passphrase(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -133,7 +136,7 @@ def test_change_passphrase_calls_borg_with_lock_wait_flags():
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -147,7 +150,7 @@ def test_change_passphrase_with_log_info_calls_borg_with_info_parameter():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -163,7 +166,7 @@ def test_change_passphrase_with_log_debug_calls_borg_with_debug_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -177,7 +180,7 @@ def test_change_passphrase_with_dry_run_skips_borg_call():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(paper=False, qr_html=False, path=None),
         change_passphrase_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=True, log_json=False),
+        global_arguments=flexmock(dry_run=True),
     )
     )
 
 
 
 
@@ -196,7 +199,7 @@ def test_change_passphrase_calls_borg_without_passphrase():
         },
         },
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -214,5 +217,5 @@ def test_change_passphrase_calls_borg_with_working_directory():
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         change_passphrase_arguments=flexmock(),
         change_passphrase_arguments=flexmock(),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )

+ 27 - 27
tests/unit/borg/test_check.py

@@ -277,7 +277,7 @@ def test_get_repository_id_with_valid_json_does_not_raise():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -294,7 +294,7 @@ def test_get_repository_id_with_json_error_raises():
             repository_path='repo',
             repository_path='repo',
             config=config,
             config=config,
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             local_path='borg',
             local_path='borg',
             remote_path=None,
             remote_path=None,
         )
         )
@@ -309,7 +309,7 @@ def test_get_repository_id_with_missing_json_keys_raises():
             repository_path='repo',
             repository_path='repo',
             config=config,
             config=config,
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             local_path='borg',
             local_path='borg',
             remote_path=None,
             remote_path=None,
         )
         )
@@ -344,7 +344,7 @@ def test_check_archives_with_progress_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -379,7 +379,7 @@ def test_check_archives_with_repair_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -414,7 +414,7 @@ def test_check_archives_with_max_duration_flag_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=33,
             max_duration=33,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -449,7 +449,7 @@ def test_check_archives_with_max_duration_option_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -481,7 +481,7 @@ def test_check_archives_with_max_duration_option_and_archives_check_runs_reposit
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository', 'archives'},
         checks={'repository', 'archives'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -513,7 +513,7 @@ def test_check_archives_with_max_duration_flag_and_archives_check_runs_repositor
             match_archives=None,
             match_archives=None,
             max_duration=33,
             max_duration=33,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository', 'archives'},
         checks={'repository', 'archives'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -545,7 +545,7 @@ def test_check_archives_with_max_duration_option_and_data_check_runs_repository_
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository', 'data'},
         checks={'repository', 'data'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -577,7 +577,7 @@ def test_check_archives_with_max_duration_flag_and_data_check_runs_repository_ch
             match_archives=None,
             match_archives=None,
             max_duration=33,
             max_duration=33,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository', 'data'},
         checks={'repository', 'data'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -612,7 +612,7 @@ def test_check_archives_with_max_duration_flag_overrides_max_duration_option():
             match_archives=None,
             match_archives=None,
             max_duration=44,
             max_duration=44,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -645,7 +645,7 @@ def test_check_archives_calls_borg_with_parameters(checks):
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -671,7 +671,7 @@ def test_check_archives_with_data_check_implies_archives_check_calls_borg_with_p
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'data'},
         checks={'data'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -698,7 +698,7 @@ def test_check_archives_with_log_info_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -725,7 +725,7 @@ def test_check_archives_with_log_debug_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -750,7 +750,7 @@ def test_check_archives_with_local_path_calls_borg_via_local_path():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
         local_path='borg1',
         local_path='borg1',
@@ -777,7 +777,7 @@ def test_check_archives_with_exit_codes_calls_borg_using_them():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -802,7 +802,7 @@ def test_check_archives_with_remote_path_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
         remote_path='borg1',
         remote_path='borg1',
@@ -828,7 +828,7 @@ def test_check_archives_with_umask_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -836,7 +836,7 @@ def test_check_archives_with_umask_passes_through_to_borg():
 
 
 def test_check_archives_with_log_json_passes_through_to_borg():
 def test_check_archives_with_log_json_passes_through_to_borg():
     checks = {'repository'}
     checks = {'repository'}
-    config = {}
+    config = {'log_json': True}
     flexmock(module).should_receive('make_check_name_flags').with_args(checks, ()).and_return(())
     flexmock(module).should_receive('make_check_name_flags').with_args(checks, ()).and_return(())
     flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
     flexmock(module.flags).should_receive('make_repository_flags').and_return(('repo',))
     insert_execute_command_mock(('borg', 'check', '--log-json', 'repo'))
     insert_execute_command_mock(('borg', 'check', '--log-json', 'repo'))
@@ -853,7 +853,7 @@ def test_check_archives_with_log_json_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -878,7 +878,7 @@ def test_check_archives_with_lock_wait_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -904,7 +904,7 @@ def test_check_archives_with_retention_prefix():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks=checks,
         checks=checks,
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -930,7 +930,7 @@ def test_check_archives_with_extra_borg_options_passes_through_to_borg():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )
@@ -965,7 +965,7 @@ def test_check_archives_with_match_archives_passes_through_to_borg():
             match_archives='foo-*',
             match_archives='foo-*',
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'archives'},
         checks={'archives'},
         archive_filter_flags=('--match-archives', 'foo-*'),
         archive_filter_flags=('--match-archives', 'foo-*'),
     )
     )
@@ -993,7 +993,7 @@ def test_check_archives_calls_borg_with_working_directory():
             match_archives=None,
             match_archives=None,
             max_duration=None,
             max_duration=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         checks={'repository'},
         checks={'repository'},
         archive_filter_flags=(),
         archive_filter_flags=(),
     )
     )

+ 16 - 16
tests/unit/borg/test_compact.py

@@ -36,7 +36,7 @@ def test_compact_segments_calls_borg_with_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -49,7 +49,7 @@ def test_compact_segments_with_log_info_calls_borg_with_info_flag():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         dry_run=False,
         dry_run=False,
     )
     )
 
 
@@ -63,7 +63,7 @@ def test_compact_segments_with_log_debug_calls_borg_with_debug_flag():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         dry_run=False,
         dry_run=False,
     )
     )
 
 
@@ -75,7 +75,7 @@ def test_compact_segments_with_dry_run_skips_borg_call():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         dry_run=True,
         dry_run=True,
     )
     )
 
 
@@ -89,7 +89,7 @@ def test_compact_segments_with_local_path_calls_borg_via_local_path():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -106,7 +106,7 @@ def test_compact_segments_with_exit_codes_calls_borg_using_them():
         repository_path='repo',
         repository_path='repo',
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -119,7 +119,7 @@ def test_compact_segments_with_remote_path_calls_borg_with_remote_path_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -133,7 +133,7 @@ def test_compact_segments_with_progress_calls_borg_with_progress_flag():
         repository_path='repo',
         repository_path='repo',
         config={'progress': True},
         config={'progress': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -146,7 +146,7 @@ def test_compact_segments_with_cleanup_commits_calls_borg_with_cleanup_commits_f
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         cleanup_commits=True,
         cleanup_commits=True,
     )
     )
 
 
@@ -160,7 +160,7 @@ def test_compact_segments_with_threshold_calls_borg_with_threshold_flag():
         repository_path='repo',
         repository_path='repo',
         config={'compact_threshold': 20},
         config={'compact_threshold': 20},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -174,7 +174,7 @@ def test_compact_segments_with_umask_calls_borg_with_umask_flags():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -185,9 +185,9 @@ def test_compact_segments_with_log_json_calls_borg_with_log_json_flags():
     module.compact_segments(
     module.compact_segments(
         dry_run=False,
         dry_run=False,
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -201,7 +201,7 @@ def test_compact_segments_with_lock_wait_calls_borg_with_lock_wait_flags():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -214,7 +214,7 @@ def test_compact_segments_with_extra_borg_options_calls_borg_with_extra_options(
         repository_path='repo',
         repository_path='repo',
         config={'extra_borg_options': {'compact': '--extra --options'}},
         config={'extra_borg_options': {'compact': '--extra --options'}},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -229,5 +229,5 @@ def test_compact_segments_calls_borg_with_working_directory():
         repository_path='repo',
         repository_path='repo',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 36 - 35
tests/unit/borg/test_create.py

@@ -343,7 +343,7 @@ def test_make_base_create_produces_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -379,7 +379,7 @@ def test_make_base_create_command_includes_patterns_file_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -411,7 +411,7 @@ def test_make_base_create_command_with_store_config_false_omits_config_files():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -476,7 +476,7 @@ def test_make_base_create_command_includes_configuration_option_as_command_flag(
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -508,7 +508,7 @@ def test_make_base_create_command_includes_dry_run_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -539,7 +539,7 @@ def test_make_base_create_command_includes_local_path_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
         local_path='borg1',
         local_path='borg1',
     )
     )
@@ -571,7 +571,7 @@ def test_make_base_create_command_includes_remote_path_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
         remote_path='borg1',
         remote_path='borg1',
     )
     )
@@ -600,10 +600,11 @@ def test_make_base_create_command_includes_log_json_in_borg_command():
         config={
         config={
             'source_directories': ['foo', 'bar'],
             'source_directories': ['foo', 'bar'],
             'repositories': ['repo'],
             'repositories': ['repo'],
+            'log_json': True,
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -635,7 +636,7 @@ def test_make_base_create_command_includes_list_flags_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -687,7 +688,7 @@ def test_make_base_create_command_with_stream_processes_ignores_read_special_fal
         },
         },
         patterns=patterns,
         patterns=patterns,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
         stream_processes=flexmock(),
         stream_processes=flexmock(),
     )
     )
@@ -738,7 +739,7 @@ def test_make_base_create_command_without_patterns_and_with_stream_processes_ign
         },
         },
         patterns=[],
         patterns=[],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
         stream_processes=flexmock(),
         stream_processes=flexmock(),
     )
     )
@@ -773,7 +774,7 @@ def test_make_base_create_command_with_stream_processes_and_read_special_true_sk
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
         stream_processes=flexmock(),
         stream_processes=flexmock(),
     )
     )
@@ -806,7 +807,7 @@ def test_make_base_create_command_includes_archive_name_format_in_borg_command()
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -837,7 +838,7 @@ def test_make_base_create_command_includes_default_archive_name_format_in_borg_c
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -869,7 +870,7 @@ def test_make_base_create_command_includes_archive_name_format_with_placeholders
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -901,7 +902,7 @@ def test_make_base_create_command_includes_repository_and_archive_name_format_wi
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -933,7 +934,7 @@ def test_make_base_create_command_includes_extra_borg_options_in_borg_command():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/run/borgmatic',
         borgmatic_runtime_directory='/run/borgmatic',
     )
     )
 
 
@@ -957,7 +958,7 @@ def test_make_base_create_command_with_non_existent_directory_and_source_directo
             },
             },
             patterns=[Pattern('foo'), Pattern('bar')],
             patterns=[Pattern('foo'), Pattern('bar')],
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             borgmatic_runtime_directory='/run/borgmatic',
             borgmatic_runtime_directory='/run/borgmatic',
         )
         )
 
 
@@ -990,7 +991,7 @@ def test_create_archive_calls_borg_with_flags():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1024,7 +1025,7 @@ def test_create_archive_calls_borg_with_environment():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1058,7 +1059,7 @@ def test_create_archive_with_log_info_calls_borg_with_info_flag():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1090,7 +1091,7 @@ def test_create_archive_with_log_info_and_json_suppresses_most_borg_output():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
         json=True,
         json=True,
     )
     )
@@ -1125,7 +1126,7 @@ def test_create_archive_with_log_debug_calls_borg_with_debug_flag():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1157,7 +1158,7 @@ def test_create_archive_with_log_debug_and_json_suppresses_most_borg_output():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
         json=True,
         json=True,
     )
     )
@@ -1194,7 +1195,7 @@ def test_create_archive_with_stats_and_dry_run_calls_borg_without_stats():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1230,7 +1231,7 @@ def test_create_archive_with_working_directory_calls_borg_with_working_directory
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1265,7 +1266,7 @@ def test_create_archive_with_exit_codes_calls_borg_using_them():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1299,7 +1300,7 @@ def test_create_archive_with_stats_calls_borg_with_stats_flag_and_answer_output_
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1337,7 +1338,7 @@ def test_create_archive_with_files_calls_borg_with_answer_output_log_level():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1372,7 +1373,7 @@ def test_create_archive_with_progress_and_log_info_calls_borg_with_progress_flag
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1406,7 +1407,7 @@ def test_create_archive_with_progress_calls_borg_with_progress_flag():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 
@@ -1462,7 +1463,7 @@ def test_create_archive_with_progress_and_stream_processes_calls_borg_with_progr
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
         stream_processes=processes,
         stream_processes=processes,
     )
     )
@@ -1494,7 +1495,7 @@ def test_create_archive_with_json_calls_borg_with_json_flag():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
         json=True,
         json=True,
     )
     )
@@ -1528,7 +1529,7 @@ def test_create_archive_with_stats_and_json_calls_borg_without_stats_flag():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
         json=True,
         json=True,
     )
     )
@@ -1567,7 +1568,7 @@ def test_create_archive_calls_borg_with_working_directory():
         },
         },
         patterns=[Pattern('foo'), Pattern('bar')],
         patterns=[Pattern('foo'), Pattern('bar')],
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         borgmatic_runtime_directory='/borgmatic/run',
         borgmatic_runtime_directory='/borgmatic/run',
     )
     )
 
 

+ 13 - 13
tests/unit/borg/test_delete.py

@@ -22,7 +22,7 @@ def test_make_delete_command_includes_log_info():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -44,7 +44,7 @@ def test_make_delete_command_includes_log_debug():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -68,7 +68,7 @@ def test_make_delete_command_includes_dry_run():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=True, log_json=False),
+        global_arguments=flexmock(dry_run=True),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -92,7 +92,7 @@ def test_make_delete_command_includes_remote_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path='borg1',
         remote_path='borg1',
     )
     )
@@ -115,7 +115,7 @@ def test_make_delete_command_includes_umask():
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -136,10 +136,10 @@ def test_make_delete_command_includes_log_json():
 
 
     command = module.make_delete_command(
     command = module.make_delete_command(
         repository={'path': 'repo'},
         repository={'path': 'repo'},
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -163,7 +163,7 @@ def test_make_delete_command_includes_lock_wait():
         config={'lock_wait': 5},
         config={'lock_wait': 5},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -187,7 +187,7 @@ def test_make_delete_command_with_list_config_calls_borg_with_list_flag():
         config={'list_details': True},
         config={'list_details': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=None, force=0, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=None, force=0, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -208,7 +208,7 @@ def test_make_delete_command_includes_force():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=1, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=1, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -229,7 +229,7 @@ def test_make_delete_command_includes_force_twice():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         delete_arguments=flexmock(list_details=False, force=2, match_archives=None, archive=None),
         delete_arguments=flexmock(list_details=False, force=2, match_archives=None, archive=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -254,7 +254,7 @@ def test_make_delete_command_includes_archive():
         delete_arguments=flexmock(
         delete_arguments=flexmock(
             list_details=False, force=0, match_archives=None, archive='archive'
             list_details=False, force=0, match_archives=None, archive='archive'
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -279,7 +279,7 @@ def test_make_delete_command_includes_match_archives():
         delete_arguments=flexmock(
         delete_arguments=flexmock(
             list_details=False, force=0, match_archives='sh:foo*', archive='archive'
             list_details=False, force=0, match_archives='sh:foo*', archive='archive'
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )

+ 19 - 19
tests/unit/borg/test_export_key.py

@@ -39,7 +39,7 @@ def test_export_key_calls_borg_with_required_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -53,7 +53,7 @@ def test_export_key_calls_borg_with_local_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -69,7 +69,7 @@ def test_export_key_calls_borg_using_exit_codes():
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -83,7 +83,7 @@ def test_export_key_calls_borg_with_remote_path_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -98,7 +98,7 @@ def test_export_key_calls_borg_with_umask_flags():
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -109,10 +109,10 @@ def test_export_key_calls_borg_with_log_json_flags():
 
 
     module.export_key(
     module.export_key(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -126,7 +126,7 @@ def test_export_key_calls_borg_with_lock_wait_flags():
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -141,7 +141,7 @@ def test_export_key_with_log_info_calls_borg_with_info_parameter():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -156,7 +156,7 @@ def test_export_key_with_log_debug_calls_borg_with_debug_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -170,7 +170,7 @@ def test_export_key_calls_borg_with_paper_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=True, qr_html=False, path=None),
         export_arguments=flexmock(paper=True, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -184,7 +184,7 @@ def test_export_key_calls_borg_with_paper_flag():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=True, qr_html=False, path=None),
         export_arguments=flexmock(paper=True, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -198,7 +198,7 @@ def test_export_key_calls_borg_with_qr_html_flag():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=True, path=None),
         export_arguments=flexmock(paper=False, qr_html=True, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -212,7 +212,7 @@ def test_export_key_calls_borg_with_path_argument():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
         export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -227,7 +227,7 @@ def test_export_key_with_already_existent_path_raises():
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
             export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
             export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
-            global_arguments=flexmock(dry_run=False, log_json=False),
+            global_arguments=flexmock(dry_run=False),
         )
         )
 
 
 
 
@@ -241,7 +241,7 @@ def test_export_key_with_stdout_path_calls_borg_without_path_argument():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path='-'),
         export_arguments=flexmock(paper=False, qr_html=False, path='-'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -255,7 +255,7 @@ def test_export_key_with_dry_run_skips_borg_call():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=True, log_json=False),
+        global_arguments=flexmock(dry_run=True),
     )
     )
 
 
 
 
@@ -269,7 +269,7 @@ def test_export_key_calls_borg_with_working_directory():
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
         export_arguments=flexmock(paper=False, qr_html=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -289,5 +289,5 @@ def test_export_key_calls_borg_with_path_argument_and_working_directory():
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
         export_arguments=flexmock(paper=False, qr_html=False, path='dest'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )

+ 17 - 17
tests/unit/borg/test_export_tar.py

@@ -48,7 +48,7 @@ def test_export_tar_archive_calls_borg_with_path_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -70,7 +70,7 @@ def test_export_tar_archive_calls_borg_with_local_path_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -95,7 +95,7 @@ def test_export_tar_archive_calls_borg_using_exit_codes():
         destination_path='test.tar',
         destination_path='test.tar',
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -117,7 +117,7 @@ def test_export_tar_archive_calls_borg_with_remote_path_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -140,7 +140,7 @@ def test_export_tar_archive_calls_borg_with_umask_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -158,9 +158,9 @@ def test_export_tar_archive_calls_borg_with_log_json_flag():
         archive='archive',
         archive='archive',
         paths=None,
         paths=None,
         destination_path='test.tar',
         destination_path='test.tar',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -182,7 +182,7 @@ def test_export_tar_archive_calls_borg_with_lock_wait_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -203,7 +203,7 @@ def test_export_tar_archive_with_log_info_calls_borg_with_info_flag():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -226,7 +226,7 @@ def test_export_tar_archive_with_log_debug_calls_borg_with_debug_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -246,7 +246,7 @@ def test_export_tar_archive_calls_borg_with_dry_run_flag():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -268,7 +268,7 @@ def test_export_tar_archive_calls_borg_with_tar_filter_flags():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         tar_filter='bzip2',
         tar_filter='bzip2',
     )
     )
 
 
@@ -292,7 +292,7 @@ def test_export_tar_archive_calls_borg_with_list_flag():
         destination_path='test.tar',
         destination_path='test.tar',
         config={'list_details': True},
         config={'list_details': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -314,7 +314,7 @@ def test_export_tar_archive_calls_borg_with_strip_components_flag():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         strip_components=5,
         strip_components=5,
     )
     )
 
 
@@ -335,7 +335,7 @@ def test_export_tar_archive_skips_abspath_for_remote_repository_flag():
         destination_path='test.tar',
         destination_path='test.tar',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -355,7 +355,7 @@ def test_export_tar_archive_calls_borg_with_stdout_destination_path():
         destination_path='-',
         destination_path='-',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -378,5 +378,5 @@ def test_export_tar_archive_calls_borg_with_working_directory():
         destination_path='test.tar',
         destination_path='test.tar',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 33 - 33
tests/unit/borg/test_extract.py

@@ -29,7 +29,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_last_archive():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -42,7 +42,7 @@ def test_extract_last_archive_dry_run_without_any_archives_should_not_raise():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -59,7 +59,7 @@ def test_extract_last_archive_dry_run_with_log_info_calls_borg_with_info_paramet
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -78,7 +78,7 @@ def test_extract_last_archive_dry_run_with_log_debug_calls_borg_with_debug_param
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -94,7 +94,7 @@ def test_extract_last_archive_dry_run_calls_borg_via_local_path():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
         local_path='borg1',
         local_path='borg1',
@@ -114,7 +114,7 @@ def test_extract_last_archive_dry_run_calls_borg_using_exit_codes():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -132,7 +132,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_remote_path_flags():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
         remote_path='borg1',
         remote_path='borg1',
@@ -147,9 +147,9 @@ def test_extract_last_archive_dry_run_calls_borg_with_log_json_flag():
     )
     )
 
 
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=None,
         lock_wait=None,
     )
     )
@@ -167,7 +167,7 @@ def test_extract_last_archive_dry_run_calls_borg_with_lock_wait_flags():
     module.extract_last_archive_dry_run(
     module.extract_last_archive_dry_run(
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         repository_path='repo',
         repository_path='repo',
         lock_wait=5,
         lock_wait=5,
     )
     )
@@ -192,7 +192,7 @@ def test_extract_archive_calls_borg_with_path_flags():
         paths=['path1', 'path2'],
         paths=['path1', 'path2'],
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -215,7 +215,7 @@ def test_extract_archive_calls_borg_with_local_path():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -242,7 +242,7 @@ def test_extract_archive_calls_borg_with_exit_codes():
         paths=None,
         paths=None,
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -265,7 +265,7 @@ def test_extract_archive_calls_borg_with_remote_path_flags():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -296,7 +296,7 @@ def test_extract_archive_calls_borg_with_numeric_ids_parameter(feature_available
         paths=None,
         paths=None,
         config={'numeric_ids': True},
         config={'numeric_ids': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -319,7 +319,7 @@ def test_extract_archive_calls_borg_with_umask_flags():
         paths=None,
         paths=None,
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -337,9 +337,9 @@ def test_extract_archive_calls_borg_with_log_json_flags():
         repository='repo',
         repository='repo',
         archive='archive',
         archive='archive',
         paths=None,
         paths=None,
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -362,7 +362,7 @@ def test_extract_archive_calls_borg_with_lock_wait_flags():
         paths=None,
         paths=None,
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -386,7 +386,7 @@ def test_extract_archive_with_log_info_calls_borg_with_info_parameter():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -412,7 +412,7 @@ def test_extract_archive_with_log_debug_calls_borg_with_debug_flags():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -435,7 +435,7 @@ def test_extract_archive_calls_borg_with_dry_run_parameter():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -458,7 +458,7 @@ def test_extract_archive_calls_borg_with_destination_path():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         destination_path='/dest',
         destination_path='/dest',
     )
     )
 
 
@@ -482,7 +482,7 @@ def test_extract_archive_calls_borg_with_strip_components():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         strip_components=5,
         strip_components=5,
     )
     )
 
 
@@ -516,7 +516,7 @@ def test_extract_archive_calls_borg_with_strip_components_calculated_from_all():
         paths=['foo/bar/baz.txt', 'foo/bar.txt'],
         paths=['foo/bar/baz.txt', 'foo/bar.txt'],
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         strip_components='all',
         strip_components='all',
     )
     )
 
 
@@ -550,7 +550,7 @@ def test_extract_archive_calls_borg_with_strip_components_calculated_from_all_wi
         paths=['/foo/bar/baz.txt', '/foo/bar.txt'],
         paths=['/foo/bar/baz.txt', '/foo/bar.txt'],
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         strip_components='all',
         strip_components='all',
     )
     )
 
 
@@ -575,7 +575,7 @@ def test_extract_archive_with_strip_components_all_and_no_paths_raises():
             paths=None,
             paths=None,
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             strip_components='all',
             strip_components='all',
         )
         )
 
 
@@ -608,7 +608,7 @@ def test_extract_archive_calls_borg_with_progress_flag():
         paths=None,
         paths=None,
         config={'progress': True},
         config={'progress': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -623,7 +623,7 @@ def test_extract_archive_with_progress_and_extract_to_stdout_raises():
             paths=None,
             paths=None,
             config={'progress': True},
             config={'progress': True},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             extract_to_stdout=True,
             extract_to_stdout=True,
         )
         )
 
 
@@ -659,7 +659,7 @@ def test_extract_archive_calls_borg_with_stdout_parameter_and_returns_process():
             paths=None,
             paths=None,
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             extract_to_stdout=True,
             extract_to_stdout=True,
         )
         )
         == process
         == process
@@ -693,7 +693,7 @@ def test_extract_archive_skips_abspath_for_remote_repository():
         paths=None,
         paths=None,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -717,7 +717,7 @@ def test_extract_archive_uses_configured_working_directory_in_repo_path_and_dest
         paths=None,
         paths=None,
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         destination_path='dest',
         destination_path='dest',
     )
     )
 
 
@@ -740,5 +740,5 @@ def test_extract_archive_uses_configured_working_directory_in_repo_path_when_des
         paths=None,
         paths=None,
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 17 - 17
tests/unit/borg/test_import_key.py

@@ -38,7 +38,7 @@ def test_import_key_calls_borg_with_required_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -53,7 +53,7 @@ def test_import_key_calls_borg_with_local_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -70,7 +70,7 @@ def test_import_key_calls_borg_using_exit_codes():
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -85,7 +85,7 @@ def test_import_key_calls_borg_with_remote_path_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -101,7 +101,7 @@ def test_import_key_calls_borg_with_umask_flags():
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -113,10 +113,10 @@ def test_import_key_calls_borg_with_log_json_flags():
 
 
     module.import_key(
     module.import_key(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -131,7 +131,7 @@ def test_import_key_calls_borg_with_lock_wait_flags():
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -147,7 +147,7 @@ def test_import_key_with_log_info_calls_borg_with_info_parameter():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -163,7 +163,7 @@ def test_import_key_with_log_debug_calls_borg_with_debug_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -178,7 +178,7 @@ def test_import_key_calls_borg_with_paper_flags():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=True, path=None),
         import_arguments=flexmock(paper=True, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -193,7 +193,7 @@ def test_import_key_calls_borg_with_path_argument():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path='source'),
         import_arguments=flexmock(paper=False, path='source'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -209,7 +209,7 @@ def test_import_key_with_non_existent_path_raises():
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
             import_arguments=flexmock(paper=False, path='source'),
             import_arguments=flexmock(paper=False, path='source'),
-            global_arguments=flexmock(dry_run=False, log_json=False),
+            global_arguments=flexmock(dry_run=False),
         )
         )
 
 
 
 
@@ -224,7 +224,7 @@ def test_import_key_with_stdin_path_calls_borg_without_path_argument():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path='-'),
         import_arguments=flexmock(paper=False, path='-'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -239,7 +239,7 @@ def test_import_key_with_dry_run_skips_borg_call():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=True, log_json=False),
+        global_arguments=flexmock(dry_run=True),
     )
     )
 
 
 
 
@@ -254,7 +254,7 @@ def test_import_key_calls_borg_with_working_directory():
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path=None),
         import_arguments=flexmock(paper=False, path=None),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )
 
 
 
 
@@ -275,5 +275,5 @@ def test_import_key_calls_borg_with_path_argument_and_working_directory():
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         import_arguments=flexmock(paper=False, path='source'),
         import_arguments=flexmock(paper=False, path='source'),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
     )
     )

+ 23 - 23
tests/unit/borg/test_info.py

@@ -20,7 +20,7 @@ def test_make_info_command_constructs_borg_info_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -42,7 +42,7 @@ def test_make_info_command_with_log_info_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -64,7 +64,7 @@ def test_make_info_command_with_log_info_and_json_omits_borg_logging_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -86,7 +86,7 @@ def test_make_info_command_with_log_debug_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -107,7 +107,7 @@ def test_make_info_command_with_log_debug_and_json_omits_borg_logging_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -128,7 +128,7 @@ def test_make_info_command_with_json_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -149,7 +149,7 @@ def test_make_info_command_with_archive_uses_match_archives_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive='archive', json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive='archive', json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -170,7 +170,7 @@ def test_make_info_command_with_local_path_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg1',
         local_path='borg1',
         remote_path=None,
         remote_path=None,
@@ -194,7 +194,7 @@ def test_make_info_command_with_remote_path_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path='borg1',
         remote_path='borg1',
@@ -217,7 +217,7 @@ def test_make_info_command_with_umask_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -239,9 +239,9 @@ def test_make_info_command_with_log_json_passes_through_to_command():
 
 
     command = module.make_info_command(
     command = module.make_info_command(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -266,7 +266,7 @@ def test_make_info_command_with_lock_wait_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -290,7 +290,7 @@ def test_make_info_command_transforms_prefix_into_match_archives_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix='foo'),
         info_arguments=flexmock(archive=None, json=False, prefix='foo'),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -314,7 +314,7 @@ def test_make_info_command_prefers_prefix_over_archive_name_format():
         repository_path='repo',
         repository_path='repo',
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix='foo'),
         info_arguments=flexmock(archive=None, json=False, prefix='foo'),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -335,7 +335,7 @@ def test_make_info_command_transforms_archive_name_format_into_match_archives_fl
         repository_path='repo',
         repository_path='repo',
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -360,7 +360,7 @@ def test_make_info_command_with_match_archives_option_passes_through_to_command(
             'match_archives': 'sh:foo-*',
             'match_archives': 'sh:foo-*',
         },
         },
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -382,7 +382,7 @@ def test_make_info_command_with_match_archives_flag_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={'archive_name_format': 'bar-{now}', 'match_archives': 'sh:foo-*'},  # noqa: FS003
         config={'archive_name_format': 'bar-{now}', 'match_archives': 'sh:foo-*'},  # noqa: FS003
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives='sh:foo-*'),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives='sh:foo-*'),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -408,7 +408,7 @@ def test_make_info_command_passes_arguments_through_to_command(argument_name):
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(
         info_arguments=flexmock(
             archive=None, json=False, prefix=None, match_archives=None, **{argument_name: 'value'}
             archive=None, json=False, prefix=None, match_archives=None, **{argument_name: 'value'}
         ),
         ),
@@ -443,7 +443,7 @@ def test_make_info_command_with_date_based_matching_passes_through_to_command():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=info_arguments,
         info_arguments=info_arguments,
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
@@ -478,7 +478,7 @@ def test_display_archives_info_calls_two_commands():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
     )
     )
 
 
@@ -498,7 +498,7 @@ def test_display_archives_info_with_json_calls_json_command_only():
             repository_path='repo',
             repository_path='repo',
             config={},
             config={},
             local_borg_version='2.3.4',
             local_borg_version='2.3.4',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
             info_arguments=flexmock(archive=None, json=True, prefix=None, match_archives=None),
         )
         )
         == json_output
         == json_output
@@ -533,6 +533,6 @@ def test_display_archives_info_calls_borg_with_working_directory():
         repository_path='repo',
         repository_path='repo',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
         info_arguments=flexmock(archive=None, json=False, prefix=None, match_archives=None),
     )
     )

+ 27 - 27
tests/unit/borg/test_list.py

@@ -20,7 +20,7 @@ def test_make_list_command_includes_log_info():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--info', 'repo')
     assert command == ('borg', 'list', '--info', 'repo')
@@ -37,7 +37,7 @@ def test_make_list_command_includes_json_but_not_info():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=True),
         list_arguments=flexmock(archive=None, paths=None, json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -54,7 +54,7 @@ def test_make_list_command_includes_log_debug():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--debug', '--show-rc', 'repo')
     assert command == ('borg', 'list', '--debug', '--show-rc', 'repo')
@@ -71,7 +71,7 @@ def test_make_list_command_includes_json_but_not_debug():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=True),
         list_arguments=flexmock(archive=None, paths=None, json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -87,7 +87,7 @@ def test_make_list_command_includes_json():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=True),
         list_arguments=flexmock(archive=None, paths=None, json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -102,10 +102,10 @@ def test_make_list_command_includes_log_json():
 
 
     command = module.make_list_command(
     command = module.make_list_command(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--log-json', 'repo')
     assert command == ('borg', 'list', '--log-json', 'repo')
@@ -123,7 +123,7 @@ def test_make_list_command_includes_lock_wait():
         config={'lock_wait': 5},
         config={'lock_wait': 5},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--lock-wait', '5', 'repo')
     assert command == ('borg', 'list', '--lock-wait', '5', 'repo')
@@ -141,7 +141,7 @@ def test_make_list_command_includes_archive():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive='archive', paths=None, json=False),
         list_arguments=flexmock(archive='archive', paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', 'repo::archive')
     assert command == ('borg', 'list', 'repo::archive')
@@ -159,7 +159,7 @@ def test_make_list_command_includes_archive_and_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive='archive', paths=['var/lib'], json=False),
         list_arguments=flexmock(archive='archive', paths=['var/lib'], json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', 'repo::archive', 'var/lib')
     assert command == ('borg', 'list', 'repo::archive', 'var/lib')
@@ -175,7 +175,7 @@ def test_make_list_command_includes_local_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg2',
         local_path='borg2',
     )
     )
 
 
@@ -198,7 +198,7 @@ def test_make_list_command_includes_remote_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg2',
         remote_path='borg2',
     )
     )
 
 
@@ -217,7 +217,7 @@ def test_make_list_command_includes_umask():
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False),
         list_arguments=flexmock(archive=None, paths=None, json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--umask', '077', 'repo')
     assert command == ('borg', 'list', '--umask', '077', 'repo')
@@ -233,7 +233,7 @@ def test_make_list_command_includes_short():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=flexmock(archive=None, paths=None, json=False, short=True),
         list_arguments=flexmock(archive=None, paths=None, json=False, short=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--short', 'repo')
     assert command == ('borg', 'list', '--short', 'repo')
@@ -272,7 +272,7 @@ def test_make_list_command_includes_additional_flags(argument_name):
             format=None,
             format=None,
             **{argument_name: 'value'},
             **{argument_name: 'value'},
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--' + argument_name.replace('_', '-'), 'value', 'repo')
     assert command == ('borg', 'list', '--' + argument_name.replace('_', '-'), 'value', 'repo')
@@ -316,7 +316,7 @@ def test_capture_archive_listing_does_not_raise():
         archive='archive',
         archive='archive',
         config={},
         config={},
         local_borg_version=flexmock(),
         local_borg_version=flexmock(),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -335,7 +335,7 @@ def test_list_archive_calls_borg_with_flags():
         first=None,
         first=None,
         last=None,
         last=None,
     )
     )
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
 
 
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module).should_receive('make_list_command').with_args(
     flexmock(module).should_receive('make_list_command').with_args(
@@ -382,7 +382,7 @@ def test_list_archive_with_archive_and_json_errors():
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
             list_arguments=list_arguments,
             list_arguments=list_arguments,
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
 
 
 
 
@@ -401,7 +401,7 @@ def test_list_archive_calls_borg_with_local_path():
         first=None,
         first=None,
         last=None,
         last=None,
     )
     )
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
 
 
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module).should_receive('make_list_command').with_args(
     flexmock(module).should_receive('make_list_command').with_args(
@@ -450,7 +450,7 @@ def test_list_archive_calls_borg_using_exit_codes():
         first=None,
         first=None,
         last=None,
         last=None,
     )
     )
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
 
 
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module.feature).should_receive('available').and_return(False)
     borg_exit_codes = flexmock()
     borg_exit_codes = flexmock()
@@ -539,7 +539,7 @@ def test_list_archive_calls_borg_multiple_times_with_find_paths():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=list_arguments,
         list_arguments=list_arguments,
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -558,7 +558,7 @@ def test_list_archive_calls_borg_with_archive():
         first=None,
         first=None,
         last=None,
         last=None,
     )
     )
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
 
 
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module).should_receive('make_list_command').with_args(
     flexmock(module).should_receive('make_list_command').with_args(
@@ -618,7 +618,7 @@ def test_list_archive_without_archive_delegates_to_list_repository():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=list_arguments,
         list_arguments=list_arguments,
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -649,7 +649,7 @@ def test_list_archive_with_borg_features_without_archive_delegates_to_list_repos
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         list_arguments=list_arguments,
         list_arguments=list_arguments,
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -669,7 +669,7 @@ def test_list_archive_with_archive_ignores_archive_filter_flag(
     flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
     flexmock(module.borgmatic.logger).should_receive('add_custom_log_levels')
     flexmock(module.logging).ANSWER = module.borgmatic.logger.ANSWER
     flexmock(module.logging).ANSWER = module.borgmatic.logger.ANSWER
     flexmock(module.logger).answer = lambda message: None
     flexmock(module.logger).answer = lambda message: None
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
     default_filter_flags = {
     default_filter_flags = {
         'prefix': None,
         'prefix': None,
         'match_archives': None,
         'match_archives': None,
@@ -741,7 +741,7 @@ def test_list_archive_with_find_paths_allows_archive_filter_flag_but_only_passes
     }
     }
     altered_filter_flags = {**default_filter_flags, **{archive_filter_flag: 'foo'}}
     altered_filter_flags = {**default_filter_flags, **{archive_filter_flag: 'foo'}}
     glob_paths = ('**/*foo.txt*/**',)
     glob_paths = ('**/*foo.txt*/**',)
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
     flexmock(module.feature).should_receive('available').and_return(True)
     flexmock(module.feature).should_receive('available').and_return(True)
 
 
     flexmock(module.repo_list).should_receive('make_repo_list_command').with_args(
     flexmock(module.repo_list).should_receive('make_repo_list_command').with_args(
@@ -855,7 +855,7 @@ def test_list_archive_calls_borg_with_working_directory():
         first=None,
         first=None,
         last=None,
         last=None,
     )
     )
-    global_arguments = flexmock(log_json=False)
+    global_arguments = flexmock()
 
 
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module.feature).should_receive('available').and_return(False)
     flexmock(module).should_receive('make_list_command').with_args(
     flexmock(module).should_receive('make_list_command').with_args(

+ 17 - 17
tests/unit/borg/test_mount.py

@@ -33,7 +33,7 @@ def test_mount_archive_calls_borg_with_required_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -56,7 +56,7 @@ def test_mount_archive_with_borg_features_calls_borg_with_repository_and_match_a
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -74,7 +74,7 @@ def test_mount_archive_without_archive_calls_borg_with_repository_flags_only():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -94,7 +94,7 @@ def test_mount_archive_calls_borg_with_path_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -112,7 +112,7 @@ def test_mount_archive_calls_borg_with_local_path():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -135,7 +135,7 @@ def test_mount_archive_calls_borg_using_exit_codes():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -155,7 +155,7 @@ def test_mount_archive_calls_borg_with_remote_path_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -174,7 +174,7 @@ def test_mount_archive_calls_borg_with_umask_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={'umask': '0770'},
         config={'umask': '0770'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -190,9 +190,9 @@ def test_mount_archive_calls_borg_with_log_json_flags():
         repository_path='repo',
         repository_path='repo',
         archive='archive',
         archive='archive',
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -210,7 +210,7 @@ def test_mount_archive_calls_borg_with_lock_wait_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={'lock_wait': '5'},
         config={'lock_wait': '5'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -229,7 +229,7 @@ def test_mount_archive_with_log_info_calls_borg_with_info_parameter():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -248,7 +248,7 @@ def test_mount_archive_with_log_debug_calls_borg_with_debug_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -275,7 +275,7 @@ def test_mount_archive_calls_borg_with_foreground_parameter():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -295,7 +295,7 @@ def test_mount_archive_calls_borg_with_options_flags():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -359,7 +359,7 @@ def test_mount_archive_with_date_based_matching_calls_borg_with_date_based_flags
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -375,5 +375,5 @@ def test_mount_archive_calls_borg_with_working_directory():
         mount_arguments=mount_arguments,
         mount_arguments=mount_arguments,
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 17 - 17
tests/unit/borg/test_prune.py

@@ -195,7 +195,7 @@ def test_prune_archives_calls_borg_with_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -217,7 +217,7 @@ def test_prune_archives_with_log_info_calls_borg_with_info_flag():
         config={},
         config={},
         dry_run=False,
         dry_run=False,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -239,7 +239,7 @@ def test_prune_archives_with_log_debug_calls_borg_with_debug_flag():
         config={},
         config={},
         dry_run=False,
         dry_run=False,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -260,7 +260,7 @@ def test_prune_archives_with_dry_run_calls_borg_with_dry_run_flag():
         config={},
         config={},
         dry_run=True,
         dry_run=True,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -281,7 +281,7 @@ def test_prune_archives_with_local_path_calls_borg_via_local_path():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
@@ -308,7 +308,7 @@ def test_prune_archives_with_exit_codes_calls_borg_using_them():
         repository_path='repo',
         repository_path='repo',
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -329,7 +329,7 @@ def test_prune_archives_with_remote_path_calls_borg_with_remote_path_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
@@ -351,7 +351,7 @@ def test_prune_archives_with_stats_config_calls_borg_with_stats_flag():
         repository_path='repo',
         repository_path='repo',
         config={'statistics': True},
         config={'statistics': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -372,7 +372,7 @@ def test_prune_archives_with_list_config_calls_borg_with_list_flag():
         repository_path='repo',
         repository_path='repo',
         config={'list_details': True},
         config={'list_details': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -394,7 +394,7 @@ def test_prune_archives_with_umask_calls_borg_with_umask_flags():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -413,9 +413,9 @@ def test_prune_archives_with_log_json_calls_borg_with_log_json_flag():
     module.prune_archives(
     module.prune_archives(
         dry_run=False,
         dry_run=False,
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -437,7 +437,7 @@ def test_prune_archives_with_lock_wait_calls_borg_with_lock_wait_flags():
         repository_path='repo',
         repository_path='repo',
         config=config,
         config=config,
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -458,7 +458,7 @@ def test_prune_archives_with_extra_borg_options_calls_borg_with_extra_options():
         repository_path='repo',
         repository_path='repo',
         config={'extra_borg_options': {'prune': '--extra --options'}},
         config={'extra_borg_options': {'prune': '--extra --options'}},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -527,7 +527,7 @@ def test_prune_archives_with_date_based_matching_calls_borg_with_date_based_flag
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -550,7 +550,7 @@ def test_prune_archives_calls_borg_with_working_directory():
         repository_path='repo',
         repository_path='repo',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )
 
 
@@ -571,6 +571,6 @@ def test_prune_archives_calls_borg_without_stats_when_feature_is_not_available()
         repository_path='repo',
         repository_path='repo',
         config={'statistics': True},
         config={'statistics': True},
         local_borg_version='2.0.0b10',
         local_borg_version='2.0.0b10',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         prune_arguments=prune_arguments,
         prune_arguments=prune_arguments,
     )
     )

+ 24 - 24
tests/unit/borg/test_recreate.py

@@ -51,7 +51,7 @@ def test_recreate_archive_dry_run_skips_execution():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         recreate_arguments=recreate_arguments,
         recreate_arguments=recreate_arguments,
-        global_arguments=flexmock(log_json=False, dry_run=True),
+        global_arguments=flexmock(dry_run=True),
         local_path='borg',
         local_path='borg',
     )
     )
 
 
@@ -86,7 +86,7 @@ def test_recreate_calls_borg_with_required_flags():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
         patterns=None,
         patterns=None,
@@ -121,7 +121,7 @@ def test_recreate_with_remote_path():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path='borg1',
         remote_path='borg1',
         patterns=None,
         patterns=None,
@@ -156,7 +156,7 @@ def test_recreate_with_lock_wait():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -192,7 +192,7 @@ def test_recreate_with_log_info():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -227,7 +227,7 @@ def test_recreate_with_log_debug():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -252,7 +252,7 @@ def test_recreate_with_log_json():
     module.recreate_archive(
     module.recreate_archive(
         repository='repo',
         repository='repo',
         archive='archive',
         archive='archive',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         recreate_arguments=flexmock(
         recreate_arguments=flexmock(
             list=None,
             list=None,
@@ -261,7 +261,7 @@ def test_recreate_with_log_json():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -297,7 +297,7 @@ def test_recreate_with_list_config_calls_borg_with_list_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -334,7 +334,7 @@ def test_recreate_with_patterns_from_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=['pattern1', 'pattern2'],
         patterns=['pattern1', 'pattern2'],
     )
     )
@@ -368,7 +368,7 @@ def test_recreate_with_exclude_flags():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -402,7 +402,7 @@ def test_recreate_with_target_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -438,7 +438,7 @@ def test_recreate_with_comment_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -474,7 +474,7 @@ def test_recreate_with_timestamp_flag():
             timestamp='2023-10-01T12:00:00',
             timestamp='2023-10-01T12:00:00',
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -508,7 +508,7 @@ def test_recreate_with_compression_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -544,7 +544,7 @@ def test_recreate_with_chunker_params_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -578,7 +578,7 @@ def test_recreate_with_recompress_flag():
             timestamp=None,
             timestamp=None,
             match_archives=None,
             match_archives=None,
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -612,7 +612,7 @@ def test_recreate_with_match_archives_star():
             timestamp=None,
             timestamp=None,
             match_archives='*',
             match_archives='*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -646,7 +646,7 @@ def test_recreate_with_match_archives_regex():
             timestamp=None,
             timestamp=None,
             match_archives='re:.*',
             match_archives='re:.*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -680,7 +680,7 @@ def test_recreate_with_match_archives_shell():
             timestamp=None,
             timestamp=None,
             match_archives='sh:*',
             match_archives='sh:*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -712,7 +712,7 @@ def test_recreate_with_match_archives_and_feature_available_calls_borg_with_matc
             timestamp=None,
             timestamp=None,
             match_archives='foo-*',
             match_archives='foo-*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -746,7 +746,7 @@ def test_recreate_with_archives_flag_and_feature_available_calls_borg_with_match
             timestamp=None,
             timestamp=None,
             match_archives='foo-*',
             match_archives='foo-*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -776,7 +776,7 @@ def test_recreate_with_match_archives_and_feature_not_available_calls_borg_witho
             timestamp=None,
             timestamp=None,
             match_archives='foo-*',
             match_archives='foo-*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )
@@ -806,7 +806,7 @@ def test_recreate_with_archives_flags_and_feature_not_available_calls_borg_with_
             timestamp=None,
             timestamp=None,
             match_archives='foo-*',
             match_archives='foo-*',
         ),
         ),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         patterns=None,
         patterns=None,
     )
     )

+ 23 - 23
tests/unit/borg/test_repo_create.py

@@ -59,7 +59,7 @@ def test_create_repository_calls_borg_with_flags():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -80,7 +80,7 @@ def test_create_repository_with_dry_run_skips_borg_call():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -106,7 +106,7 @@ def test_create_repository_raises_for_borg_repo_create_error():
             repository_path='repo',
             repository_path='repo',
             config={},
             config={},
             local_borg_version='2.3.4',
             local_borg_version='2.3.4',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             encryption_mode='repokey',
             encryption_mode='repokey',
         )
         )
 
 
@@ -126,7 +126,7 @@ def test_create_repository_skips_creation_when_repository_already_exists():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -147,7 +147,7 @@ def test_create_repository_errors_when_repository_with_differing_encryption_mode
             repository_path='repo',
             repository_path='repo',
             config={},
             config={},
             local_borg_version='2.3.4',
             local_borg_version='2.3.4',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             encryption_mode='repokey-blake2',
             encryption_mode='repokey-blake2',
         )
         )
 
 
@@ -163,7 +163,7 @@ def test_create_repository_raises_for_unknown_repo_info_command_error():
             repository_path='repo',
             repository_path='repo',
             config={},
             config={},
             local_borg_version='2.3.4',
             local_borg_version='2.3.4',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             encryption_mode='repokey',
             encryption_mode='repokey',
         )
         )
 
 
@@ -186,7 +186,7 @@ def test_create_repository_with_source_repository_calls_borg_with_other_repo_fla
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         source_repository='other.borg',
         source_repository='other.borg',
     )
     )
@@ -208,7 +208,7 @@ def test_create_repository_with_copy_crypt_key_calls_borg_with_copy_crypt_key_fl
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         copy_crypt_key=True,
         copy_crypt_key=True,
     )
     )
@@ -230,7 +230,7 @@ def test_create_repository_with_append_only_calls_borg_with_append_only_flag():
         repository_path='repo',
         repository_path='repo',
         config={'append_only': True},
         config={'append_only': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         append_only=True,
         append_only=True,
     )
     )
@@ -252,7 +252,7 @@ def test_create_repository_with_append_only_config_calls_borg_with_append_only_f
         repository_path='repo',
         repository_path='repo',
         config={'append_only': True},
         config={'append_only': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         append_only=True,
         append_only=True,
     )
     )
@@ -276,7 +276,7 @@ def test_create_repository_with_storage_quota_calls_borg_with_storage_quota_flag
         repository_path='repo',
         repository_path='repo',
         config={'storage_quota': '5G'},
         config={'storage_quota': '5G'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         storage_quota='5G',
         storage_quota='5G',
     )
     )
@@ -298,7 +298,7 @@ def test_create_repository_with_make_parent_dirs_calls_borg_with_make_parent_dir
         repository_path='repo',
         repository_path='repo',
         config={'make_parent_directories': True},
         config={'make_parent_directories': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         make_parent_directories=True,
         make_parent_directories=True,
     )
     )
@@ -321,7 +321,7 @@ def test_create_repository_with_log_info_calls_borg_with_info_flag():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -343,7 +343,7 @@ def test_create_repository_with_log_debug_calls_borg_with_debug_flag():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -362,9 +362,9 @@ def test_create_repository_with_log_json_calls_borg_with_log_json_flag():
     module.create_repository(
     module.create_repository(
         dry_run=False,
         dry_run=False,
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -385,7 +385,7 @@ def test_create_repository_with_lock_wait_calls_borg_with_lock_wait_flag():
         repository_path='repo',
         repository_path='repo',
         config={'lock_wait': 5},
         config={'lock_wait': 5},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -406,7 +406,7 @@ def test_create_repository_with_local_path_calls_borg_via_local_path():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         local_path='borg1',
         local_path='borg1',
     )
     )
@@ -431,7 +431,7 @@ def test_create_repository_with_exit_codes_calls_borg_using_them():
         repository_path='repo',
         repository_path='repo',
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -454,7 +454,7 @@ def test_create_repository_with_remote_path_calls_borg_with_remote_path_flag():
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
         remote_path='borg1',
         remote_path='borg1',
     )
     )
@@ -476,7 +476,7 @@ def test_create_repository_with_umask_calls_borg_with_umask_flag():
         repository_path='repo',
         repository_path='repo',
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -499,7 +499,7 @@ def test_create_repository_with_extra_borg_options_calls_borg_with_extra_options
         repository_path='repo',
         repository_path='repo',
         config={'extra_borg_options': {'repo-create': '--extra --options'}},
         config={'extra_borg_options': {'repo-create': '--extra --options'}},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )
 
 
@@ -522,6 +522,6 @@ def test_create_repository_calls_borg_with_working_directory():
         repository_path='repo',
         repository_path='repo',
         config={'working_directory': '/working/dir'},
         config={'working_directory': '/working/dir'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         encryption_mode='repokey',
         encryption_mode='repokey',
     )
     )

+ 13 - 13
tests/unit/borg/test_repo_delete.py

@@ -20,7 +20,7 @@ def test_make_repo_delete_command_with_feature_available_runs_borg_repo_delete()
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -41,7 +41,7 @@ def test_make_repo_delete_command_without_feature_available_runs_borg_delete():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -63,7 +63,7 @@ def test_make_repo_delete_command_includes_log_info():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -85,7 +85,7 @@ def test_make_repo_delete_command_includes_log_debug():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -109,7 +109,7 @@ def test_make_repo_delete_command_includes_dry_run():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=True, log_json=False),
+        global_arguments=flexmock(dry_run=True),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -133,7 +133,7 @@ def test_make_repo_delete_command_includes_remote_path():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path='borg1',
         remote_path='borg1',
     )
     )
@@ -156,7 +156,7 @@ def test_make_repo_delete_command_includes_umask():
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -177,10 +177,10 @@ def test_make_repo_delete_command_includes_log_json():
 
 
     command = module.make_repo_delete_command(
     command = module.make_repo_delete_command(
         repository={'path': 'repo'},
         repository={'path': 'repo'},
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=True),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -204,7 +204,7 @@ def test_make_repo_delete_command_includes_lock_wait():
         config={'lock_wait': 5},
         config={'lock_wait': 5},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=0),
         repo_delete_arguments=flexmock(list_details=False, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -228,7 +228,7 @@ def test_make_repo_delete_command_includes_list():
         config={'list_details': True},
         config={'list_details': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=True, force=0),
         repo_delete_arguments=flexmock(list_details=True, force=0),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -249,7 +249,7 @@ def test_make_repo_delete_command_includes_force():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=1),
         repo_delete_arguments=flexmock(list_details=False, force=1),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )
@@ -270,7 +270,7 @@ def test_make_repo_delete_command_includes_force_twice():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_delete_arguments=flexmock(list_details=False, force=2),
         repo_delete_arguments=flexmock(list_details=False, force=2),
-        global_arguments=flexmock(dry_run=False, log_json=False),
+        global_arguments=flexmock(dry_run=False),
         local_path='borg',
         local_path='borg',
         remote_path=None,
         remote_path=None,
     )
     )

+ 15 - 15
tests/unit/borg/test_repo_info.py

@@ -44,7 +44,7 @@ def test_display_repository_info_calls_borg_with_flags():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -80,7 +80,7 @@ def test_display_repository_info_without_borg_features_calls_borg_with_info_sub_
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -121,7 +121,7 @@ def test_display_repository_info_with_log_info_calls_borg_with_info_flag():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -155,7 +155,7 @@ def test_display_repository_info_with_log_info_and_json_suppresses_most_borg_out
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=True),
         repo_info_arguments=flexmock(json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert json_output == '[]'
     assert json_output == '[]'
@@ -199,7 +199,7 @@ def test_display_repository_info_with_log_debug_calls_borg_with_debug_flag():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -233,7 +233,7 @@ def test_display_repository_info_with_log_debug_and_json_suppresses_most_borg_ou
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=True),
         repo_info_arguments=flexmock(json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert json_output == '[]'
     assert json_output == '[]'
@@ -268,7 +268,7 @@ def test_display_repository_info_with_json_calls_borg_with_json_flag():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=True),
         repo_info_arguments=flexmock(json=True),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert json_output == '[]'
     assert json_output == '[]'
@@ -311,7 +311,7 @@ def test_display_repository_info_with_local_path_calls_borg_via_local_path():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg1',
         local_path='borg1',
     )
     )
 
 
@@ -354,7 +354,7 @@ def test_display_repository_info_with_exit_codes_calls_borg_using_them():
         config={'borg_exit_codes': borg_exit_codes},
         config={'borg_exit_codes': borg_exit_codes},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -395,7 +395,7 @@ def test_display_repository_info_with_remote_path_calls_borg_with_remote_path_fl
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg1',
         remote_path='borg1',
     )
     )
 
 
@@ -437,7 +437,7 @@ def test_display_repository_info_with_umask_calls_borg_with_umask_flags():
         config={'umask': '077'},
         config={'umask': '077'},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path=None,
         remote_path=None,
     )
     )
 
 
@@ -479,10 +479,10 @@ def test_display_repository_info_with_log_json_calls_borg_with_log_json_flags():
 
 
     module.display_repository_info(
     module.display_repository_info(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -524,7 +524,7 @@ def test_display_repository_info_with_lock_wait_calls_borg_with_lock_wait_flags(
         config=config,
         config=config,
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -567,5 +567,5 @@ def test_display_repository_info_calls_borg_with_working_directory():
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         repo_info_arguments=flexmock(json=False),
         repo_info_arguments=flexmock(json=False),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 31 - 31
tests/unit/borg/test_repo_list.py

@@ -25,7 +25,7 @@ def test_resolve_archive_name_passes_through_non_latest_archive_name():
             archive,
             archive,
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == archive
         == archive
     )
     )
@@ -49,7 +49,7 @@ def test_resolve_archive_name_calls_borg_with_flags():
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -74,7 +74,7 @@ def test_resolve_archive_name_with_log_info_calls_borg_without_info_flag():
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -99,7 +99,7 @@ def test_resolve_archive_name_with_log_debug_calls_borg_without_debug_flag():
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -123,7 +123,7 @@ def test_resolve_archive_name_with_local_path_calls_borg_via_local_path():
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             local_path='borg1',
             local_path='borg1',
         )
         )
         == expected_archive
         == expected_archive
@@ -149,7 +149,7 @@ def test_resolve_archive_name_with_exit_codes_calls_borg_using_them():
             'latest',
             'latest',
             config={'borg_exit_codes': borg_exit_codes},
             config={'borg_exit_codes': borg_exit_codes},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -173,7 +173,7 @@ def test_resolve_archive_name_with_remote_path_calls_borg_with_remote_path_flags
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
             remote_path='borg1',
             remote_path='borg1',
         )
         )
         == expected_archive
         == expected_archive
@@ -198,7 +198,7 @@ def test_resolve_archive_name_with_umask_calls_borg_with_umask_flags():
             'latest',
             'latest',
             config={'umask': '077'},
             config={'umask': '077'},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -221,7 +221,7 @@ def test_resolve_archive_name_without_archives_raises():
             'latest',
             'latest',
             config={},
             config={},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
 
 
 
 
@@ -242,9 +242,9 @@ def test_resolve_archive_name_with_log_json_calls_borg_with_log_json_flags():
         module.resolve_archive_name(
         module.resolve_archive_name(
             'repo',
             'repo',
             'latest',
             'latest',
-            config={},
+            config={'log_json': True},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=True),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -269,7 +269,7 @@ def test_resolve_archive_name_with_lock_wait_calls_borg_with_lock_wait_flags():
             'latest',
             'latest',
             config={'lock_wait': 'okay'},
             config={'lock_wait': 'okay'},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -295,7 +295,7 @@ def test_resolve_archive_name_calls_borg_with_working_directory():
             'latest',
             'latest',
             config={'working_directory': '/working/dir'},
             config={'working_directory': '/working/dir'},
             local_borg_version='1.2.3',
             local_borg_version='1.2.3',
-            global_arguments=flexmock(log_json=False),
+            global_arguments=flexmock(),
         )
         )
         == expected_archive
         == expected_archive
     )
     )
@@ -317,7 +317,7 @@ def test_make_repo_list_command_includes_log_info():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--info', 'repo')
     assert command == ('borg', 'list', '--info', 'repo')
@@ -339,7 +339,7 @@ def test_make_repo_list_command_includes_json_but_not_info():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=True, prefix=None, match_archives=None
             archive=None, paths=None, json=True, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -361,7 +361,7 @@ def test_make_repo_list_command_includes_log_debug():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--debug', '--show-rc', 'repo')
     assert command == ('borg', 'list', '--debug', '--show-rc', 'repo')
@@ -383,7 +383,7 @@ def test_make_repo_list_command_includes_json_but_not_debug():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=True, prefix=None, match_archives=None
             archive=None, paths=None, json=True, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -404,7 +404,7 @@ def test_make_repo_list_command_includes_json():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=True, prefix=None, match_archives=None
             archive=None, paths=None, json=True, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--json', 'repo')
     assert command == ('borg', 'list', '--json', 'repo')
@@ -422,12 +422,12 @@ def test_make_repo_list_command_includes_log_json():
 
 
     command = module.make_repo_list_command(
     command = module.make_repo_list_command(
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--log-json', 'repo')
     assert command == ('borg', 'list', '--log-json', 'repo')
@@ -450,7 +450,7 @@ def test_make_repo_list_command_includes_lock_wait():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--lock-wait', '5', 'repo')
     assert command == ('borg', 'list', '--lock-wait', '5', 'repo')
@@ -471,7 +471,7 @@ def test_make_repo_list_command_includes_local_path():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg2',
         local_path='borg2',
     )
     )
 
 
@@ -495,7 +495,7 @@ def test_make_repo_list_command_includes_remote_path():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg2',
         remote_path='borg2',
     )
     )
 
 
@@ -519,7 +519,7 @@ def test_make_repo_list_command_includes_umask():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--umask', '077', 'repo')
     assert command == ('borg', 'list', '--umask', '077', 'repo')
@@ -540,7 +540,7 @@ def test_make_repo_list_command_transforms_prefix_into_match_archives():
         config={},
         config={},
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_list_arguments=flexmock(archive=None, paths=None, json=False, prefix='foo'),
         repo_list_arguments=flexmock(archive=None, paths=None, json=False, prefix='foo'),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--match-archives', 'sh:foo*', 'repo')
     assert command == ('borg', 'list', '--match-archives', 'sh:foo*', 'repo')
@@ -559,7 +559,7 @@ def test_make_repo_list_command_prefers_prefix_over_archive_name_format():
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         config={'archive_name_format': 'bar-{now}'},  # noqa: FS003
         local_borg_version='1.2.3',
         local_borg_version='1.2.3',
         repo_list_arguments=flexmock(archive=None, paths=None, json=False, prefix='foo'),
         repo_list_arguments=flexmock(archive=None, paths=None, json=False, prefix='foo'),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--match-archives', 'sh:foo*', 'repo')
     assert command == ('borg', 'list', '--match-archives', 'sh:foo*', 'repo')
@@ -580,7 +580,7 @@ def test_make_repo_list_command_transforms_archive_name_format_into_match_archiv
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None
             archive=None, paths=None, json=False, prefix=None, match_archives=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--match-archives', 'sh:bar-*', 'repo')
     assert command == ('borg', 'list', '--match-archives', 'sh:bar-*', 'repo')
@@ -601,7 +601,7 @@ def test_make_repo_list_command_includes_short():
         repo_list_arguments=flexmock(
         repo_list_arguments=flexmock(
             archive=None, paths=None, json=False, prefix=None, match_archives=None, short=True
             archive=None, paths=None, json=False, prefix=None, match_archives=None, short=True
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--short', 'repo')
     assert command == ('borg', 'list', '--short', 'repo')
@@ -643,7 +643,7 @@ def test_make_repo_list_command_includes_additional_flags(argument_name):
             format=None,
             format=None,
             **{argument_name: 'value'},
             **{argument_name: 'value'},
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--' + argument_name.replace('_', '-'), 'value', 'repo')
     assert command == ('borg', 'list', '--' + argument_name.replace('_', '-'), 'value', 'repo')
@@ -675,7 +675,7 @@ def test_make_repo_list_command_with_match_archives_calls_borg_with_match_archiv
             find_paths=None,
             find_paths=None,
             format=None,
             format=None,
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == ('borg', 'list', '--match-archives', 'foo-*', 'repo')
     assert command == ('borg', 'list', '--match-archives', 'foo-*', 'repo')
@@ -746,7 +746,7 @@ def test_make_repo_list_command_with_date_based_matching_calls_borg_with_date_ba
             older='1m',
             older='1m',
             oldest='1w',
             oldest='1w',
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
     assert command == (
     assert command == (

+ 19 - 19
tests/unit/borg/test_transfer.py

@@ -35,7 +35,7 @@ def test_transfer_archives_calls_borg_with_flags():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -69,7 +69,7 @@ def test_transfer_archives_with_dry_run_calls_borg_with_dry_run_flag():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -100,7 +100,7 @@ def test_transfer_archives_with_log_info_calls_borg_with_info_flag():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -132,7 +132,7 @@ def test_transfer_archives_with_log_debug_calls_borg_with_debug_flag():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -165,7 +165,7 @@ def test_transfer_archives_with_archive_calls_borg_with_match_archives_flag():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive='archive', progress=None, match_archives=None, source_repository=None
             archive='archive', progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -198,7 +198,7 @@ def test_transfer_archives_with_match_archives_calls_borg_with_match_archives_fl
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives='sh:foo*', source_repository=None
             archive=None, progress=None, match_archives='sh:foo*', source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -231,7 +231,7 @@ def test_transfer_archives_with_archive_name_format_calls_borg_with_match_archiv
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -262,7 +262,7 @@ def test_transfer_archives_with_local_path_calls_borg_via_local_path():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         local_path='borg2',
         local_path='borg2',
     )
     )
 
 
@@ -295,7 +295,7 @@ def test_transfer_archives_with_exit_codes_calls_borg_using_them():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -329,7 +329,7 @@ def test_transfer_archives_with_remote_path_calls_borg_with_remote_path_flags():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         remote_path='borg2',
         remote_path='borg2',
     )
     )
 
 
@@ -363,7 +363,7 @@ def test_transfer_archives_with_umask_calls_borg_with_umask_flags():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -392,12 +392,12 @@ def test_transfer_archives_with_log_json_calls_borg_with_log_json_flags():
     module.transfer_archives(
     module.transfer_archives(
         dry_run=False,
         dry_run=False,
         repository_path='repo',
         repository_path='repo',
-        config={},
+        config={'log_json': True},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=True),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -432,7 +432,7 @@ def test_transfer_archives_with_lock_wait_calls_borg_with_lock_wait_flags():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -466,7 +466,7 @@ def test_transfer_archives_with_progress_calls_borg_with_progress_flags():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -505,7 +505,7 @@ def test_transfer_archives_passes_through_arguments_to_borg(argument_name):
             source_repository=None,
             source_repository=None,
             **{argument_name: 'value'},
             **{argument_name: 'value'},
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -538,7 +538,7 @@ def test_transfer_archives_with_source_repository_calls_borg_with_other_repo_fla
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository='other'
             archive=None, progress=None, match_archives=None, source_repository='other'
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )
 
 
 
 
@@ -580,7 +580,7 @@ def test_transfer_archives_with_date_based_matching_calls_borg_with_date_based_f
         repository_path='repo',
         repository_path='repo',
         config={},
         config={},
         local_borg_version='2.3.4',
         local_borg_version='2.3.4',
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None,
             archive=None,
             progress=None,
             progress=None,
@@ -622,5 +622,5 @@ def test_transfer_archives_calls_borg_with_working_directory():
         transfer_arguments=flexmock(
         transfer_arguments=flexmock(
             archive=None, progress=None, match_archives=None, source_repository=None
             archive=None, progress=None, match_archives=None, source_repository=None
         ),
         ),
-        global_arguments=flexmock(log_json=False),
+        global_arguments=flexmock(),
     )
     )

+ 174 - 77
tests/unit/commands/test_borgmatic.py

@@ -421,7 +421,7 @@ def test_run_configuration_runs_actions_for_each_repository():
         expected_results[1:]
         expected_results[1:]
     )
     )
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
-    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False)}
 
 
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
 
 
@@ -437,7 +437,7 @@ def test_run_configuration_with_skip_actions_does_not_raise():
     flexmock(module).should_receive('Log_prefix').and_return(flexmock())
     flexmock(module).should_receive('Log_prefix').and_return(flexmock())
     flexmock(module).should_receive('run_actions').and_return(flexmock()).and_return(flexmock())
     flexmock(module).should_receive('run_actions').and_return(flexmock()).and_return(flexmock())
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}], 'skip_actions': ['compact']}
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}], 'skip_actions': ['compact']}
-    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False)}
 
 
     list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
     list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
 
 
@@ -452,7 +452,7 @@ def test_run_configuration_with_invalid_borg_version_errors():
     flexmock(module).should_receive('run_actions').never()
     flexmock(module).should_receive('run_actions').never()
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'prune': flexmock(),
         'prune': flexmock(),
     }
     }
 
 
@@ -472,7 +472,7 @@ def test_run_configuration_logs_actions_error():
     flexmock(module.command).should_receive('filter_hooks')
     flexmock(module.command).should_receive('filter_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
-    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(monitoring_verbosity=1, dry_run=False)}
 
 
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
 
 
@@ -493,7 +493,7 @@ def test_run_configuration_skips_remaining_actions_for_actions_soft_failure_but_
     flexmock(module.command).should_receive('considered_soft_failure').and_return(True)
     flexmock(module.command).should_receive('considered_soft_failure').and_return(True)
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -514,7 +514,7 @@ def test_run_configuration_does_not_call_monitoring_hooks_if_monitoring_hooks_ar
 
 
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=-2, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=-2, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
     results = list(module.run_configuration('test.yaml', config, ['/tmp/test.yaml'], arguments))
@@ -537,7 +537,7 @@ def test_run_configuration_logs_on_error_hook_error():
     flexmock(module).should_receive('run_actions').and_raise(OSError)
     flexmock(module).should_receive('run_actions').and_raise(OSError)
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -560,7 +560,7 @@ def test_run_configuration_logs_on_before_command_hook_error():
     flexmock(module).should_receive('run_actions').never()
     flexmock(module).should_receive('run_actions').never()
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -583,7 +583,7 @@ def test_run_configuration_logs_on_monitoring_hook_error():
     flexmock(module).should_receive('run_actions').never()
     flexmock(module).should_receive('run_actions').never()
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -607,7 +607,7 @@ def test_run_configuration_bails_for_on_error_hook_soft_failure():
     flexmock(module).should_receive('run_actions').and_raise(OSError)
     flexmock(module).should_receive('run_actions').and_raise(OSError)
     config = {'repositories': [{'path': 'foo'}]}
     config = {'repositories': [{'path': 'foo'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -630,7 +630,7 @@ def test_run_configuration_retries_soft_error():
     flexmock(module.command).should_receive('execute_hooks').never()
     flexmock(module.command).should_receive('execute_hooks').never()
     config = {'repositories': [{'path': 'foo'}], 'retries': 1}
     config = {'repositories': [{'path': 'foo'}], 'retries': 1}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -663,7 +663,7 @@ def test_run_configuration_retries_hard_error():
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     config = {'repositories': [{'path': 'foo'}], 'retries': 1}
     config = {'repositories': [{'path': 'foo'}], 'retries': 1}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -691,7 +691,7 @@ def test_run_configuration_retries_repositories_in_order():
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
     config = {'repositories': [{'path': 'foo'}, {'path': 'bar'}]}
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -735,7 +735,7 @@ def test_run_configuration_retries_round_robin():
         'retries': 1,
         'retries': 1,
     }
     }
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -777,7 +777,7 @@ def test_run_configuration_with_one_retry():
         'retries': 1,
         'retries': 1,
     }
     }
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -830,7 +830,7 @@ def test_run_configuration_with_retry_wait_does_backoff_after_each_retry():
         'retry_wait': 10,
         'retry_wait': 10,
     }
     }
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -879,7 +879,7 @@ def test_run_configuration_with_multiple_repositories_retries_with_timeout():
         'retry_wait': 10,
         'retry_wait': 10,
     }
     }
     arguments = {
     arguments = {
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
         'create': flexmock(),
         'create': flexmock(),
     }
     }
 
 
@@ -897,7 +897,7 @@ def test_run_actions_runs_repo_create():
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
             arguments={
             arguments={
-                'global': flexmock(dry_run=False, log_file='foo'),
+                'global': flexmock(dry_run=False),
                 'repo-create': flexmock(),
                 'repo-create': flexmock(),
             },
             },
             config_filename=flexmock(),
             config_filename=flexmock(),
@@ -931,7 +931,7 @@ def test_run_actions_adds_label_file_to_hook_context():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file=None), 'create': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'create': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -952,7 +952,7 @@ def test_run_actions_adds_log_file_to_hook_context():
     flexmock(borgmatic.actions.create).should_receive('run_create').with_args(
     flexmock(borgmatic.actions.create).should_receive('run_create').with_args(
         config_filename=object,
         config_filename=object,
         repository={'path': 'repo'},
         repository={'path': 'repo'},
-        config={'repositories': []},
+        config={'repositories': [], 'log_file': 'foo'},
         config_paths=[],
         config_paths=[],
         local_borg_version=object,
         local_borg_version=object,
         create_arguments=object,
         create_arguments=object,
@@ -964,9 +964,9 @@ def test_run_actions_adds_log_file_to_hook_context():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'create': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'create': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
-            config={'repositories': []},
+            config={'repositories': [], 'log_file': 'foo'},
             config_paths=[],
             config_paths=[],
             local_path=flexmock(),
             local_path=flexmock(),
             remote_path=flexmock(),
             remote_path=flexmock(),
@@ -985,7 +985,7 @@ def test_run_actions_runs_transfer():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'transfer': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'transfer': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1006,7 +1006,7 @@ def test_run_actions_runs_create():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'create': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'create': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1027,7 +1027,7 @@ def test_run_actions_with_skip_actions_skips_create():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'create': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'create': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': [], 'skip_actions': ['create']},
             config={'repositories': [], 'skip_actions': ['create']},
             config_paths=[],
             config_paths=[],
@@ -1048,7 +1048,7 @@ def test_run_actions_runs_recreate():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'recreate': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'recreate': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1068,7 +1068,7 @@ def test_run_actions_with_skip_actions_skips_recreate():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'recreate': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'recreate': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': [], 'skip_actions': ['recreate']},
             config={'repositories': [], 'skip_actions': ['recreate']},
             config_paths=[],
             config_paths=[],
@@ -1088,7 +1088,7 @@ def test_run_actions_runs_prune():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'prune': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'prune': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1108,7 +1108,7 @@ def test_run_actions_with_skip_actions_skips_prune():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'prune': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'prune': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': [], 'skip_actions': ['prune']},
             config={'repositories': [], 'skip_actions': ['prune']},
             config_paths=[],
             config_paths=[],
@@ -1128,7 +1128,7 @@ def test_run_actions_runs_compact():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'compact': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'compact': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1148,7 +1148,7 @@ def test_run_actions_with_skip_actions_skips_compact():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'compact': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'compact': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': [], 'skip_actions': ['compact']},
             config={'repositories': [], 'skip_actions': ['compact']},
             config_paths=[],
             config_paths=[],
@@ -1169,7 +1169,7 @@ def test_run_actions_runs_check_when_repository_enabled_for_checks():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'check': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'check': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1190,7 +1190,7 @@ def test_run_actions_skips_check_when_repository_not_enabled_for_checks():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'check': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'check': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1211,7 +1211,7 @@ def test_run_actions_with_skip_actions_skips_check():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'check': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'check': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': [], 'skip_actions': ['check']},
             config={'repositories': [], 'skip_actions': ['check']},
             config_paths=[],
             config_paths=[],
@@ -1231,7 +1231,7 @@ def test_run_actions_runs_extract():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'extract': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'extract': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1251,7 +1251,7 @@ def test_run_actions_runs_export_tar():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'export-tar': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'export-tar': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1271,7 +1271,7 @@ def test_run_actions_runs_mount():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'mount': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'mount': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1291,7 +1291,7 @@ def test_run_actions_runs_restore():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'restore': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'restore': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1312,7 +1312,7 @@ def test_run_actions_runs_repo_list():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'repo-list': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'repo-list': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1334,7 +1334,7 @@ def test_run_actions_runs_list():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'list': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'list': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1356,7 +1356,7 @@ def test_run_actions_runs_repo_info():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'repo-info': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'repo-info': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1378,7 +1378,7 @@ def test_run_actions_runs_info():
 
 
     result = tuple(
     result = tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'info': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'info': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1399,7 +1399,7 @@ def test_run_actions_runs_break_lock():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'break-lock': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'break-lock': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1419,7 +1419,7 @@ def test_run_actions_runs_export_key():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'export': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'export': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1439,7 +1439,7 @@ def test_run_actions_runs_import_key():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'import': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'import': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1460,7 +1460,7 @@ def test_run_actions_runs_change_passphrase():
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
             arguments={
             arguments={
-                'global': flexmock(dry_run=False, log_file='foo'),
+                'global': flexmock(dry_run=False),
                 'change-passphrase': flexmock(),
                 'change-passphrase': flexmock(),
             },
             },
             config_filename=flexmock(),
             config_filename=flexmock(),
@@ -1482,7 +1482,7 @@ def test_run_actions_runs_delete():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'delete': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'delete': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1503,7 +1503,7 @@ def test_run_actions_runs_repo_delete():
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
             arguments={
             arguments={
-                'global': flexmock(dry_run=False, log_file='foo'),
+                'global': flexmock(dry_run=False),
                 'repo-delete': flexmock(),
                 'repo-delete': flexmock(),
             },
             },
             config_filename=flexmock(),
             config_filename=flexmock(),
@@ -1525,7 +1525,7 @@ def test_run_actions_runs_borg():
 
 
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
-            arguments={'global': flexmock(dry_run=False, log_file='foo'), 'borg': flexmock()},
+            arguments={'global': flexmock(dry_run=False), 'borg': flexmock()},
             config_filename=flexmock(),
             config_filename=flexmock(),
             config={'repositories': []},
             config={'repositories': []},
             config_paths=[],
             config_paths=[],
@@ -1547,7 +1547,7 @@ def test_run_actions_runs_multiple_actions_in_argument_order():
     tuple(
     tuple(
         module.run_actions(
         module.run_actions(
             arguments={
             arguments={
-                'global': flexmock(dry_run=False, log_file='foo'),
+                'global': flexmock(dry_run=False),
                 'borg': flexmock(),
                 'borg': flexmock(),
                 'restore': flexmock(),
                 'restore': flexmock(),
             },
             },
@@ -1856,11 +1856,14 @@ def test_collect_configuration_run_summary_logs_info_for_success():
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module).should_receive('Log_prefix').and_return(flexmock())
     flexmock(module).should_receive('Log_prefix').and_return(flexmock())
     flexmock(module).should_receive('run_configuration').and_return([])
     flexmock(module).should_receive('run_configuration').and_return([])
-    arguments = {'global': flexmock(dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(dry_run=False)}
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1875,12 +1878,15 @@ def test_collect_configuration_run_summary_executes_hooks_for_create():
     flexmock(module).should_receive('run_configuration').and_return([])
     flexmock(module).should_receive('run_configuration').and_return([])
     arguments = {
     arguments = {
         'create': flexmock(),
         'create': flexmock(),
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1895,12 +1901,15 @@ def test_collect_configuration_run_summary_logs_info_for_success_with_extract():
     flexmock(module).should_receive('run_configuration').and_return([])
     flexmock(module).should_receive('run_configuration').and_return([])
     arguments = {
     arguments = {
         'extract': flexmock(repository='repo'),
         'extract': flexmock(repository='repo'),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1913,11 +1922,14 @@ def test_collect_configuration_run_summary_logs_extract_with_repository_error():
     )
     )
     expected_logs = (flexmock(),)
     expected_logs = (flexmock(),)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
-    arguments = {'extract': flexmock(repository='repo', log_file=flexmock())}
+    arguments = {'extract': flexmock(repository='repo')}
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1932,12 +1944,15 @@ def test_collect_configuration_run_summary_logs_info_for_success_with_mount():
     flexmock(module).should_receive('run_configuration').and_return([])
     flexmock(module).should_receive('run_configuration').and_return([])
     arguments = {
     arguments = {
         'mount': flexmock(repository='repo'),
         'mount': flexmock(repository='repo'),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1952,12 +1967,15 @@ def test_collect_configuration_run_summary_logs_mount_with_repository_error():
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     arguments = {
     arguments = {
         'mount': flexmock(repository='repo'),
         'mount': flexmock(repository='repo'),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -1968,12 +1986,14 @@ def test_collect_configuration_run_summary_logs_missing_configs_error():
     flexmock(module.validate).should_receive('guard_configuration_contains_repository')
     flexmock(module.validate).should_receive('guard_configuration_contains_repository')
     flexmock(module.command).should_receive('filter_hooks')
     flexmock(module.command).should_receive('filter_hooks')
     flexmock(module.command).should_receive('execute_hooks')
     flexmock(module.command).should_receive('execute_hooks')
-    arguments = {'global': flexmock(config_paths=[], log_file=flexmock())}
+    arguments = {'global': flexmock(config_paths=[])}
     expected_logs = (flexmock(),)
     expected_logs = (flexmock(),)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
 
 
     logs = tuple(
     logs = tuple(
-        module.collect_configuration_run_summary_logs({}, config_paths=[], arguments=arguments)
+        module.collect_configuration_run_summary_logs(
+            {}, config_paths=[], arguments=arguments, log_file_path=None
+        )
     )
     )
 
 
     assert logs == expected_logs
     assert logs == expected_logs
@@ -1987,12 +2007,15 @@ def test_collect_configuration_run_summary_logs_pre_hook_error():
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     arguments = {
     arguments = {
         'create': flexmock(),
         'create': flexmock(),
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2009,12 +2032,15 @@ def test_collect_configuration_run_summary_logs_post_hook_error():
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     arguments = {
     arguments = {
         'create': flexmock(),
         'create': flexmock(),
-        'global': flexmock(monitoring_verbosity=1, dry_run=False, log_file=flexmock()),
+        'global': flexmock(monitoring_verbosity=1, dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2029,12 +2055,15 @@ def test_collect_configuration_run_summary_logs_for_list_with_archive_and_reposi
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     flexmock(module).should_receive('log_error_records').and_return(expected_logs)
     arguments = {
     arguments = {
         'list': flexmock(repository='repo', archive='test'),
         'list': flexmock(repository='repo', archive='test'),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2049,12 +2078,15 @@ def test_collect_configuration_run_summary_logs_info_for_success_with_list():
     flexmock(module).should_receive('run_configuration').and_return([])
     flexmock(module).should_receive('run_configuration').and_return([])
     arguments = {
     arguments = {
         'list': flexmock(repository='repo', archive=None),
         'list': flexmock(repository='repo', archive=None),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2070,11 +2102,14 @@ def test_collect_configuration_run_summary_logs_run_configuration_error_logs():
         [logging.makeLogRecord(dict(levelno=logging.CRITICAL, levelname='CRITICAL', msg='Error'))]
         [logging.makeLogRecord(dict(levelno=logging.CRITICAL, levelname='CRITICAL', msg='Error'))]
     )
     )
     flexmock(module).should_receive('log_error_records').and_return([])
     flexmock(module).should_receive('log_error_records').and_return([])
-    arguments = {'global': flexmock(dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(dry_run=False)}
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2093,12 +2128,15 @@ def test_collect_configuration_run_summary_logs_run_umount_error():
     )
     )
     arguments = {
     arguments = {
         'umount': flexmock(mount_point='/mnt'),
         'umount': flexmock(mount_point='/mnt'),
-        'global': flexmock(dry_run=False, log_file=flexmock()),
+        'global': flexmock(dry_run=False),
     }
     }
 
 
     logs = tuple(
     logs = tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
-            {'test.yaml': {}}, config_paths=['/tmp/test.yaml'], arguments=arguments
+            {'test.yaml': {}},
+            config_paths=['/tmp/test.yaml'],
+            arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2116,13 +2154,14 @@ def test_collect_configuration_run_summary_logs_outputs_merged_json_results():
     stdout = flexmock()
     stdout = flexmock()
     stdout.should_receive('write').with_args('["foo", "bar", "baz"]').once()
     stdout.should_receive('write').with_args('["foo", "bar", "baz"]').once()
     flexmock(module.sys).stdout = stdout
     flexmock(module.sys).stdout = stdout
-    arguments = {'global': flexmock(dry_run=False, log_file=flexmock())}
+    arguments = {'global': flexmock(dry_run=False)}
 
 
     tuple(
     tuple(
         module.collect_configuration_run_summary_logs(
         module.collect_configuration_run_summary_logs(
             {'test.yaml': {}, 'test2.yaml': {}},
             {'test.yaml': {}, 'test2.yaml': {}},
             config_paths=['/tmp/test.yaml', '/tmp/test2.yaml'],
             config_paths=['/tmp/test.yaml', '/tmp/test2.yaml'],
             arguments=arguments,
             arguments=arguments,
+            log_file_path=None,
         )
         )
     )
     )
 
 
@@ -2178,3 +2217,61 @@ def test_check_and_show_help_on_no_args_with_conflicting_configs():
     flexmock(module.sys).should_receive('exit').never()
     flexmock(module.sys).should_receive('exit').never()
 
 
     module.check_and_show_help_on_no_args(configs)
     module.check_and_show_help_on_no_args(configs)
+
+
+def test_get_singular_option_value_with_conflicting_values_exits():
+    flexmock(module).should_receive('configure_logging')
+    flexmock(module).should_receive('exit_with_help_link').once()
+
+    module.get_singular_option_value(
+        configs={
+            'test1.yaml': {'foo': 1, 'bar': 'baz'},
+            'test2.yaml': {'foo': 2, 'bar': 'baz'},
+        },
+        option_name='foo',
+    )
+
+
+def test_get_singular_option_value_with_same_value_returns_it():
+    flexmock(module).should_receive('configure_logging').never()
+    flexmock(module).should_receive('exit_with_help_link').never()
+
+    assert (
+        module.get_singular_option_value(
+            configs={
+                'test1.yaml': {'foo': 1, 'bar': 'baz'},
+                'test2.yaml': {'foo': 1, 'bar': 'baz'},
+            },
+            option_name='foo',
+        )
+        == 1
+    )
+
+
+def test_get_singular_option_value_with_no_values_returns_none():
+    flexmock(module).should_receive('configure_logging').never()
+    flexmock(module).should_receive('exit_with_help_link').never()
+
+    assert (
+        module.get_singular_option_value(
+            configs={
+                'test1.yaml': {'bar': 'baz'},
+                'test2.yaml': {'bar': 'baz'},
+            },
+            option_name='foo',
+        )
+        is None
+    )
+
+
+def test_get_singular_option_value_with_no_config_returns_none():
+    flexmock(module).should_receive('configure_logging').never()
+    flexmock(module).should_receive('exit_with_help_link').never()
+
+    assert (
+        module.get_singular_option_value(
+            configs={},
+            option_name='foo',
+        )
+        is None
+    )

+ 5 - 12
tests/unit/hooks/monitoring/test_healthchecks.py

@@ -3,18 +3,10 @@ from flexmock import flexmock
 from borgmatic.hooks.monitoring import healthchecks as module
 from borgmatic.hooks.monitoring import healthchecks as module
 
 
 
 
-def mock_logger():
-    logger = flexmock()
-    logger.should_receive('addHandler')
-    logger.should_receive('removeHandler')
-    flexmock(module.logging).should_receive('getLogger').and_return(logger)
-
-
 def test_initialize_monitor_creates_log_handler_with_ping_body_limit():
 def test_initialize_monitor_creates_log_handler_with_ping_body_limit():
     ping_body_limit = 100
     ping_body_limit = 100
     monitoring_log_level = 1
     monitoring_log_level = 1
 
 
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).with_args(
     ).with_args(
@@ -22,6 +14,7 @@ def test_initialize_monitor_creates_log_handler_with_ping_body_limit():
         ping_body_limit - len(module.borgmatic.hooks.monitoring.logs.PAYLOAD_TRUNCATION_INDICATOR),
         ping_body_limit - len(module.borgmatic.hooks.monitoring.logs.PAYLOAD_TRUNCATION_INDICATOR),
         monitoring_log_level,
         monitoring_log_level,
     ).once()
     ).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'ping_body_limit': ping_body_limit}, {}, 'test.yaml', monitoring_log_level, dry_run=False
         {'ping_body_limit': ping_body_limit}, {}, 'test.yaml', monitoring_log_level, dry_run=False
@@ -31,7 +24,6 @@ def test_initialize_monitor_creates_log_handler_with_ping_body_limit():
 def test_initialize_monitor_creates_log_handler_with_default_ping_body_limit():
 def test_initialize_monitor_creates_log_handler_with_default_ping_body_limit():
     monitoring_log_level = 1
     monitoring_log_level = 1
 
 
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).with_args(
     ).with_args(
@@ -40,6 +32,7 @@ def test_initialize_monitor_creates_log_handler_with_default_ping_body_limit():
         - len(module.borgmatic.hooks.monitoring.logs.PAYLOAD_TRUNCATION_INDICATOR),
         - len(module.borgmatic.hooks.monitoring.logs.PAYLOAD_TRUNCATION_INDICATOR),
         monitoring_log_level,
         monitoring_log_level,
     ).once()
     ).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor({}, {}, 'test.yaml', monitoring_log_level, dry_run=False)
     module.initialize_monitor({}, {}, 'test.yaml', monitoring_log_level, dry_run=False)
 
 
@@ -48,10 +41,10 @@ def test_initialize_monitor_creates_log_handler_with_zero_ping_body_limit():
     ping_body_limit = 0
     ping_body_limit = 0
     monitoring_log_level = 1
     monitoring_log_level = 1
 
 
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).with_args(module.HANDLER_IDENTIFIER, ping_body_limit, monitoring_log_level).once()
     ).with_args(module.HANDLER_IDENTIFIER, ping_body_limit, monitoring_log_level).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'ping_body_limit': ping_body_limit}, {}, 'test.yaml', monitoring_log_level, dry_run=False
         {'ping_body_limit': ping_body_limit}, {}, 'test.yaml', monitoring_log_level, dry_run=False
@@ -59,10 +52,10 @@ def test_initialize_monitor_creates_log_handler_with_zero_ping_body_limit():
 
 
 
 
 def test_initialize_monitor_creates_log_handler_when_send_logs_true():
 def test_initialize_monitor_creates_log_handler_when_send_logs_true():
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).once()
     ).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'send_logs': True}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
         {'send_logs': True}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
@@ -70,10 +63,10 @@ def test_initialize_monitor_creates_log_handler_when_send_logs_true():
 
 
 
 
 def test_initialize_monitor_bails_when_send_logs_false():
 def test_initialize_monitor_bails_when_send_logs_false():
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).never()
     ).never()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'send_logs': False}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
         {'send_logs': False}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False

+ 14 - 1
tests/unit/hooks/monitoring/test_logs.py

@@ -37,6 +37,16 @@ def test_forgetful_buffering_handler_emit_forgets_log_records_when_capacity_reac
     assert handler.forgot
     assert handler.forgot
 
 
 
 
+def test_add_handler_does_not_raise():
+    logger = flexmock(handlers=[flexmock(level=0)])
+    flexmock(module.logging).should_receive('getLogger').and_return(logger)
+    flexmock(logger).should_receive('addHandler')
+    flexmock(logger).should_receive('removeHandler')
+    flexmock(logger).should_receive('setLevel')
+
+    module.add_handler(flexmock())
+
+
 def test_get_handler_matches_by_identifier():
 def test_get_handler_matches_by_identifier():
     handlers = [
     handlers = [
         flexmock(),
         flexmock(),
@@ -92,7 +102,10 @@ def test_format_buffered_logs_for_payload_without_handler_produces_empty_payload
 
 
 def test_remove_handler_with_matching_handler_does_not_raise():
 def test_remove_handler_with_matching_handler_does_not_raise():
     flexmock(module).should_receive('get_handler').and_return(flexmock())
     flexmock(module).should_receive('get_handler').and_return(flexmock())
-    flexmock(module.logging.getLogger()).should_receive('removeHandler')
+    logger = flexmock(handlers=[flexmock(level=0)])
+    flexmock(module.logging).should_receive('getLogger').and_return(logger)
+    flexmock(logger).should_receive('removeHandler')
+    flexmock(logger).should_receive('setLevel')
 
 
     module.remove_handler('test')
     module.remove_handler('test')
 
 

+ 3 - 10
tests/unit/hooks/monitoring/test_pagerduty.py

@@ -3,29 +3,22 @@ from flexmock import flexmock
 from borgmatic.hooks.monitoring import pagerduty as module
 from borgmatic.hooks.monitoring import pagerduty as module
 
 
 
 
-def mock_logger():
-    logger = flexmock()
-    logger.should_receive('addHandler')
-    logger.should_receive('removeHandler')
-    flexmock(module.logging).should_receive('getLogger').and_return(logger)
-
-
 def test_initialize_monitor_creates_log_handler():
 def test_initialize_monitor_creates_log_handler():
     monitoring_log_level = 1
     monitoring_log_level = 1
 
 
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).once()
     ).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor({}, {}, 'test.yaml', monitoring_log_level, dry_run=False)
     module.initialize_monitor({}, {}, 'test.yaml', monitoring_log_level, dry_run=False)
 
 
 
 
 def test_initialize_monitor_creates_log_handler_when_send_logs_true():
 def test_initialize_monitor_creates_log_handler_when_send_logs_true():
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).once()
     ).once()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'send_logs': True}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
         {'send_logs': True}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
@@ -33,10 +26,10 @@ def test_initialize_monitor_creates_log_handler_when_send_logs_true():
 
 
 
 
 def test_initialize_monitor_bails_when_send_logs_false():
 def test_initialize_monitor_bails_when_send_logs_false():
-    mock_logger()
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
     flexmock(module.borgmatic.hooks.monitoring.logs).should_receive(
         'Forgetful_buffering_handler'
         'Forgetful_buffering_handler'
     ).never()
     ).never()
+    flexmock(module.borgmatic.hooks.monitoring.logs).should_receive('add_handler')
 
 
     module.initialize_monitor(
     module.initialize_monitor(
         {'send_logs': False}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False
         {'send_logs': False}, {}, 'test.yaml', monitoring_log_level=1, dry_run=False

+ 65 - 0
tests/unit/test_verbosity.py

@@ -1,5 +1,6 @@
 import logging
 import logging
 
 
+import pytest
 from flexmock import flexmock
 from flexmock import flexmock
 
 
 from borgmatic import verbosity as module
 from borgmatic import verbosity as module
@@ -31,3 +32,67 @@ def test_verbosity_to_log_level_maps_unknown_verbosity_to_warning_level():
     flexmock(module.logging).ANSWER = module.borgmatic.logger.ANSWER
     flexmock(module.logging).ANSWER = module.borgmatic.logger.ANSWER
 
 
     assert module.verbosity_to_log_level('my pants') == logging.WARNING
     assert module.verbosity_to_log_level('my pants') == logging.WARNING
+
+
+@pytest.mark.parametrize(
+    'option_name',
+    (
+        'verbosity',
+        'syslog_verbosity',
+        'log_file_verbosity',
+        'monitoring_verbosity',
+    ),
+)
+def test_get_verbosity_gets_maximum_verbosity_across_configurations(option_name):
+    assert (
+        module.get_verbosity(
+            configs={
+                'test1.yaml': {option_name: -1},
+                'test2.yaml': {option_name: 2},
+                'test3.yaml': {option_name: None},
+            },
+            option_name=option_name,
+        )
+        == 2
+    )
+
+
+@pytest.mark.parametrize(
+    'option_name',
+    (
+        'verbosity',
+        'syslog_verbosity',
+        'log_file_verbosity',
+        'monitoring_verbosity',
+    ),
+)
+def test_get_verbosity_with_nothing_set_gets_default_verbosity(option_name):
+    assert (
+        module.get_verbosity(
+            configs={
+                'test1.yaml': {},
+                'test2.yaml': {'other': 'thing'},
+            },
+            option_name=option_name,
+        )
+        == module.DEFAULT_VERBOSITIES[option_name]
+    )
+
+
+@pytest.mark.parametrize(
+    'option_name',
+    (
+        'verbosity',
+        'syslog_verbosity',
+        'log_file_verbosity',
+        'monitoring_verbosity',
+    ),
+)
+def test_get_verbosity_with_no_configs_set_gets_default_verbosity(option_name):
+    assert (
+        module.get_verbosity(
+            configs={},
+            option_name=option_name,
+        )
+        == module.DEFAULT_VERBOSITIES[option_name]
+    )