From 395817ee3b2945c034434493e59cdbde8a7a7352 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam <3275593+pradyunsg@users.noreply.github.com> Date: Tue, 1 Dec 2020 14:28:16 +0000 Subject: [PATCH] Revert "Redact auth from URL in UpdatingDefaultsHelpFormatter" --- src/pip/_internal/cli/parser.py | 13 +------------ tests/functional/test_help.py | 10 ---------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/src/pip/_internal/cli/parser.py b/src/pip/_internal/cli/parser.py index ea3b383e2..b6b78318a 100644 --- a/src/pip/_internal/cli/parser.py +++ b/src/pip/_internal/cli/parser.py @@ -17,7 +17,6 @@ from pip._vendor.six import string_types from pip._internal.cli.status_codes import UNKNOWN_ERROR from pip._internal.configuration import Configuration, ConfigurationError from pip._internal.utils.compat import get_terminal_size -from pip._internal.utils.misc import redact_auth_from_url logger = logging.getLogger(__name__) @@ -107,22 +106,12 @@ class UpdatingDefaultsHelpFormatter(PrettyHelpFormatter): This is updates the defaults before expanding them, allowing them to show up correctly in the help listing. - - Also redact auth from url type options """ def expand_default(self, option): - default_value = None if self.parser is not None: self.parser._update_defaults(self.parser.defaults) - default_value = self.parser.defaults.get(option.dest) - help_text = optparse.IndentedHelpFormatter.expand_default(self, option) - - if default_value and option.metavar == 'URL': - help_text = help_text.replace( - default_value, redact_auth_from_url(default_value)) - - return help_text + return optparse.IndentedHelpFormatter.expand_default(self, option) class CustomOptionParser(optparse.OptionParser): diff --git a/tests/functional/test_help.py b/tests/functional/test_help.py index 9c2508abb..00a395006 100644 --- a/tests/functional/test_help.py +++ b/tests/functional/test_help.py @@ -64,16 +64,6 @@ def test_help_command_should_exit_status_error_when_cmd_does_not_exist(script): assert result.returncode == ERROR -def test_help_command_redact_auth_from_url(script): - """ - Test `help` on various subcommands redact auth from url - """ - script.environ['PIP_INDEX_URL'] = 'https://user:secret@example.com' - result = script.pip('install', '--help') - assert result.returncode == SUCCESS - assert 'secret' not in result.stdout - - def test_help_commands_equally_functional(in_memory_pip): """ Test if `pip help` and 'pip --help' behave the same way.