Skip to content

Commit

Permalink
Change format_command_result() to use format_command_args().
Browse files Browse the repository at this point in the history
  • Loading branch information
cjerdonek committed Feb 22, 2019
1 parent 0f67763 commit 87f0539
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/pip/_internal/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
from pip._internal.models.link import Link
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
LOG_DIVIDER, call_subprocess, captured_stdout, ensure_dir, read_chunks,
LOG_DIVIDER, call_subprocess, captured_stdout, ensure_dir,
format_command_args, read_chunks,
)
from pip._internal.utils.setuptools_build import SETUPTOOLS_SHIM
from pip._internal.utils.temp_dir import TempDirectory
Expand Down Expand Up @@ -794,7 +795,8 @@ def format_command_result(
"""
Format command information for logging.
"""
text = 'Command arguments: {}\n'.format(command_args)
command_desc = format_command_args(command_args)
text = 'Command arguments: {}\n'.format(command_desc)

if not command_output:
text += 'Command output: None'
Expand Down
13 changes: 7 additions & 6 deletions tests/unit/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ def test_should_use_ephemeral_cache__issue_6197(
def test_format_command_result__INFO(caplog):
caplog.set_level(logging.INFO)
actual = wheel.format_command_result(
command_args=['arg1', 'arg2'],
# 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', 'arg2']",
"Command arguments: arg1 'second arg'",
'Command output: [use --verbose to show]',
]

Expand All @@ -124,7 +125,7 @@ def test_format_command_result__DEBUG(caplog, command_output):
command_output=command_output,
)
assert actual.splitlines() == [
"Command arguments: ['arg1', 'arg2']",
"Command arguments: arg1 arg2",
'Command output:',
'output line 1',
'output line 2',
Expand All @@ -140,7 +141,7 @@ def test_format_command_result__empty_output(caplog, log_level):
command_output='',
)
assert actual.splitlines() == [
"Command arguments: ['arg1', 'arg2']",
"Command arguments: arg1 arg2",
'Command output: None',
]

Expand Down Expand Up @@ -171,7 +172,7 @@ def test_get_legacy_build_wheel_path__no_names(caplog):
assert record.levelname == 'WARNING'
assert record.message.splitlines() == [
"Legacy build of wheel for 'pendulum' created no files.",
"Command arguments: ['arg1', 'arg2']",
"Command arguments: arg1 arg2",
'Command output: [use --verbose to show]',
]

Expand All @@ -188,7 +189,7 @@ def test_get_legacy_build_wheel_path__multiple_names(caplog):
assert record.message.splitlines() == [
"Legacy build of wheel for 'pendulum' created more than one file.",
"Filenames (choosing first): ['name1', 'name2']",
"Command arguments: ['arg1', 'arg2']",
"Command arguments: arg1 arg2",
'Command output: [use --verbose to show]',
]

Expand Down

0 comments on commit 87f0539

Please sign in to comment.