Remove unused function parameter.
This commit is contained in:
parent
a4eef383c3
commit
12cf6913ef
2 changed files with 6 additions and 8 deletions
|
@ -9,10 +9,10 @@ ERROR_OUTPUT_MAX_LINE_COUNT = 25
|
||||||
BORG_ERROR_EXIT_CODE = 2
|
BORG_ERROR_EXIT_CODE = 2
|
||||||
|
|
||||||
|
|
||||||
def exit_code_indicates_error(command, exit_code, error_on_warnings=True):
|
def exit_code_indicates_error(exit_code, error_on_warnings=True):
|
||||||
'''
|
'''
|
||||||
Return True if the given exit code from running the command corresponds to an error.
|
Return True if the given exit code from running a command corresponds to an error. If error on
|
||||||
If error on warnings is False, then treat exit code 1 as a warning instead of an error.
|
warnings is False, then treat exit code 1 as a warning instead of an error.
|
||||||
'''
|
'''
|
||||||
if error_on_warnings:
|
if error_on_warnings:
|
||||||
return bool(exit_code != 0)
|
return bool(exit_code != 0)
|
||||||
|
@ -48,7 +48,7 @@ def log_output(command, process, output_buffer, output_log_level, error_on_warni
|
||||||
|
|
||||||
exit_code = process.poll()
|
exit_code = process.poll()
|
||||||
|
|
||||||
if exit_code_indicates_error(command, exit_code, error_on_warnings):
|
if exit_code_indicates_error(exit_code, error_on_warnings):
|
||||||
# If an error occurs, include its output in the raised exception so that we don't
|
# If an error occurs, include its output in the raised exception so that we don't
|
||||||
# inadvertently hide error output.
|
# inadvertently hide error output.
|
||||||
if len(last_lines) == ERROR_OUTPUT_MAX_LINE_COUNT:
|
if len(last_lines) == ERROR_OUTPUT_MAX_LINE_COUNT:
|
||||||
|
@ -124,5 +124,5 @@ def execute_command_without_capture(full_command, working_directory=None, error_
|
||||||
try:
|
try:
|
||||||
subprocess.check_call(full_command, cwd=working_directory)
|
subprocess.check_call(full_command, cwd=working_directory)
|
||||||
except subprocess.CalledProcessError as error:
|
except subprocess.CalledProcessError as error:
|
||||||
if exit_code_indicates_error(full_command, error.returncode, error_on_warnings):
|
if exit_code_indicates_error(error.returncode, error_on_warnings):
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -19,9 +19,7 @@ def test_exit_code_indicates_error_respects_exit_code_and_error_on_warnings(
|
||||||
exit_code, error_on_warnings, expected_result
|
exit_code, error_on_warnings, expected_result
|
||||||
):
|
):
|
||||||
assert (
|
assert (
|
||||||
module.exit_code_indicates_error(
|
module.exit_code_indicates_error(exit_code, error_on_warnings=error_on_warnings)
|
||||||
('command',), exit_code, error_on_warnings=error_on_warnings
|
|
||||||
)
|
|
||||||
is expected_result
|
is expected_result
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue