def test_format_command_result__empty_output(caplog, log_level): caplog.set_level(log_level) actual = format_command_result( command_args=['arg1', 'arg2'], command_output='', ) assert actual.splitlines() == [ "Command arguments: arg1 arg2", 'Command output: None', ]
def test_format_command_result__empty_output(caplog: pytest.LogCaptureFixture, log_level: str) -> None: caplog.set_level(log_level) actual = format_command_result( command_args=["arg1", "arg2"], command_output="", ) assert actual.splitlines() == [ "Command arguments: arg1 arg2", "Command output: None", ]
def test_format_command_result__INFO(caplog: pytest.LogCaptureFixture) -> None: caplog.set_level(logging.INFO) actual = format_command_result( # Include an argument with a space to test argument quoting. command_args=["arg1", "second arg"], command_output="output line 1\noutput line 2\n", ) assert actual.splitlines() == [ "Command arguments: arg1 'second arg'", "Command output: [use --verbose to show]", ]
def test_format_command_result__INFO(caplog): caplog.set_level(logging.INFO) actual = format_command_result( # Include an argument with a space to test argument quoting. command_args=['arg1', 'second arg'], command_output='output line 1\noutput line 2\n', ) assert actual.splitlines() == [ "Command arguments: arg1 'second arg'", 'Command output: [use --verbose to show]', ]
def test_format_command_result__DEBUG(caplog: pytest.LogCaptureFixture, command_output: str) -> None: caplog.set_level(logging.DEBUG) actual = format_command_result( command_args=["arg1", "arg2"], command_output=command_output, ) assert actual.splitlines() == [ "Command arguments: arg1 arg2", "Command output:", "output line 1", "output line 2", ]
def test_format_command_result__DEBUG(caplog, command_output): caplog.set_level(logging.DEBUG) actual = format_command_result( command_args=['arg1', 'arg2'], command_output=command_output, ) assert actual.splitlines() == [ "Command arguments: arg1 arg2", 'Command output:', 'output line 1', 'output line 2', '----------------------------------------', ]