summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPradyun Gedam <3275593+pradyunsg@users.noreply.github.com>2020-12-01 14:28:16 +0000
committerGitHub <noreply@github.com>2020-12-01 14:28:16 +0000
commit395817ee3b2945c034434493e59cdbde8a7a7352 (patch)
tree20c6132dccad9005ecdfa02033df7c40811b4a30
parentdce6b34abb0f283d765032434adc620a91134c88 (diff)
downloadpip-revert-9163-redact-url-from-help.tar.gz
Revert "Redact auth from URL in UpdatingDefaultsHelpFormatter"revert-9163-redact-url-from-help
-rw-r--r--src/pip/_internal/cli/parser.py13
-rw-r--r--tests/functional/test_help.py10
2 files changed, 1 insertions, 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.