mirror of
https://github.com/borgmatic-collective/borgmatic.git
synced 2026-07-25 03:13:02 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bc9482970 | ||
|
|
57ffad4e04 | ||
|
|
5422d14f93 | ||
|
|
e6d8c736d0 | ||
|
|
18d3542fbc | ||
|
|
93f453cecf | ||
|
|
505bb778fa | ||
|
|
b09d464162 |
+10
@@ -40,6 +40,16 @@ steps:
|
||||
- scripts/run-tests
|
||||
---
|
||||
kind: pipeline
|
||||
name: python-3-8-alpine-3-10
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: python:3.8-alpine3.10
|
||||
pull: always
|
||||
commands:
|
||||
- scripts/run-tests
|
||||
---
|
||||
kind: pipeline
|
||||
name: documentation
|
||||
|
||||
steps:
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
1.4.6
|
||||
* Verbosity level "-1" for even quieter output: Errors only (#236).
|
||||
|
||||
1.4.5
|
||||
* Log to file instead of syslog via command-line "--log-file" flag.
|
||||
* Log to file instead of syslog via command-line "--log-file" flag (#233).
|
||||
|
||||
1.4.4
|
||||
* #234: Support for Borg --keep-exclude-tags and --exclude-nodump options.
|
||||
|
||||
@@ -138,23 +138,23 @@ def parse_arguments(*unparsed_arguments):
|
||||
'-v',
|
||||
'--verbosity',
|
||||
type=int,
|
||||
choices=range(0, 3),
|
||||
choices=range(-1, 3),
|
||||
default=0,
|
||||
help='Display verbose progress to the console (from none to lots: 0, 1, or 2)',
|
||||
help='Display verbose progress to the console (from none to lots: 0, 1, or 2) or only errors (-1)',
|
||||
)
|
||||
global_group.add_argument(
|
||||
'--syslog-verbosity',
|
||||
type=int,
|
||||
choices=range(0, 3),
|
||||
choices=range(-1, 3),
|
||||
default=0,
|
||||
help='Log verbose progress to syslog (from none to lots: 0, 1, or 2). Ignored when console is interactive or --log-file is given',
|
||||
help='Log verbose progress to syslog (from none to lots: 0, 1, or 2) or only errors (-1). Ignored when console is interactive or --log-file is given',
|
||||
)
|
||||
global_group.add_argument(
|
||||
'--log-file-verbosity',
|
||||
type=int,
|
||||
choices=range(0, 3),
|
||||
default=1,
|
||||
help='Log verbose progress to log file (from none to lots: 0, 1, or 2). Only used when --log-file is given',
|
||||
choices=range(-1, 3),
|
||||
default=0,
|
||||
help='Log verbose progress to log file (from none to lots: 0, 1, or 2) or only errors (-1). Only used when --log-file is given',
|
||||
)
|
||||
global_group.add_argument(
|
||||
'--log-file',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
|
||||
VERBOSITY_ERROR = -1
|
||||
VERBOSITY_WARNING = 0
|
||||
VERBOSITY_SOME = 1
|
||||
VERBOSITY_LOTS = 2
|
||||
@@ -10,6 +11,7 @@ def verbosity_to_log_level(verbosity):
|
||||
Given a borgmatic verbosity value, return the corresponding Python log level.
|
||||
'''
|
||||
return {
|
||||
VERBOSITY_ERROR: logging.ERROR,
|
||||
VERBOSITY_WARNING: logging.WARNING,
|
||||
VERBOSITY_SOME: logging.INFO,
|
||||
VERBOSITY_LOTS: logging.DEBUG,
|
||||
|
||||
@@ -62,6 +62,8 @@ following:
|
||||
tox -e black
|
||||
```
|
||||
|
||||
Note that Black requires at minimum Python 3.6.
|
||||
|
||||
And if you get a complaint from the
|
||||
[isort](https://github.com/timothycrosley/isort) Python import orderer, you
|
||||
can ask isort to order your imports for you:
|
||||
|
||||
@@ -80,7 +80,7 @@ borgmatic --log-file /path/to/file.log
|
||||
```
|
||||
|
||||
Note that if you use the `--log-file` flag, you are responsible for rotating
|
||||
the log file so it doesn't grow too large. Also, there is also
|
||||
the log file so it doesn't grow too large. Also, there is a
|
||||
`--log-file-verbosity` flag to customize the log file's log level.
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from setuptools import find_packages, setup
|
||||
|
||||
VERSION = '1.4.5'
|
||||
VERSION = '1.4.6'
|
||||
|
||||
|
||||
setup(
|
||||
|
||||
@@ -15,6 +15,7 @@ def test_parse_arguments_with_no_arguments_uses_defaults():
|
||||
assert global_arguments.excludes_filename is None
|
||||
assert global_arguments.verbosity == 0
|
||||
assert global_arguments.syslog_verbosity == 0
|
||||
assert global_arguments.log_file_verbosity == 0
|
||||
|
||||
|
||||
def test_parse_arguments_with_multiple_config_paths_parses_as_list():
|
||||
@@ -26,6 +27,7 @@ def test_parse_arguments_with_multiple_config_paths_parses_as_list():
|
||||
assert global_arguments.config_paths == ['myconfig', 'otherconfig']
|
||||
assert global_arguments.verbosity == 0
|
||||
assert global_arguments.syslog_verbosity == 0
|
||||
assert global_arguments.log_file_verbosity == 0
|
||||
|
||||
|
||||
def test_parse_arguments_with_verbosity_overrides_default():
|
||||
@@ -39,6 +41,7 @@ def test_parse_arguments_with_verbosity_overrides_default():
|
||||
assert global_arguments.excludes_filename is None
|
||||
assert global_arguments.verbosity == 1
|
||||
assert global_arguments.syslog_verbosity == 0
|
||||
assert global_arguments.log_file_verbosity == 0
|
||||
|
||||
|
||||
def test_parse_arguments_with_syslog_verbosity_overrides_default():
|
||||
@@ -54,6 +57,20 @@ def test_parse_arguments_with_syslog_verbosity_overrides_default():
|
||||
assert global_arguments.syslog_verbosity == 2
|
||||
|
||||
|
||||
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.excludes_filename is None
|
||||
assert global_arguments.verbosity == 0
|
||||
assert global_arguments.syslog_verbosity == 0
|
||||
assert global_arguments.log_file_verbosity == -1
|
||||
|
||||
|
||||
def test_parse_arguments_with_list_json_overrides_default():
|
||||
arguments = module.parse_arguments('list', '--json')
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ def insert_logging_mock(log_level):
|
||||
def test_verbosity_to_log_level_maps_known_verbosity_to_log_level():
|
||||
assert module.verbosity_to_log_level(module.VERBOSITY_SOME) == logging.INFO
|
||||
assert module.verbosity_to_log_level(module.VERBOSITY_LOTS) == logging.DEBUG
|
||||
assert module.verbosity_to_log_level(module.VERBOSITY_ERROR) == logging.ERROR
|
||||
|
||||
|
||||
def test_verbosity_to_log_level_maps_unknown_verbosity_to_warning_level():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = py35,py36,py37
|
||||
envlist = py35,py36,py37,py38
|
||||
skip_missing_interpreters = True
|
||||
skipsdist = True
|
||||
minversion = 3.14.0
|
||||
@@ -14,14 +14,13 @@ commands_pre =
|
||||
find {toxinidir} -type f -not -path '{toxinidir}/.tox/*' -path '*/__pycache__/*' -name '*.py[c|o]' -delete
|
||||
commands =
|
||||
pytest {posargs}
|
||||
py36,py37: black --check .
|
||||
py36,py37,py38: black --check .
|
||||
isort --recursive --check-only --settings-path setup.cfg .
|
||||
flake8 borgmatic tests
|
||||
|
||||
[testenv:black]
|
||||
basepython = python3.7
|
||||
commands =
|
||||
black {posargs} .
|
||||
py36,py37,py38: black {posargs} .
|
||||
|
||||
[testenv:test]
|
||||
commands =
|
||||
|
||||
Reference in New Issue
Block a user