Skip to content

Commit 62e932a

Browse files
authored
Merge pull request #11942 from Darsstar/correct-keyring-provider-default
Correct keyring provider default
2 parents cd7aeb7 + 9605b97 commit 62e932a

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

news/CD497476-8620-449D-8E31-799CDBCF3FD6.trivial.rst

Whitespace-only changes.

src/pip/_internal/cli/cmdoptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class PipOption(Option):
257257
"--keyring-provider",
258258
dest="keyring_provider",
259259
choices=["auto", "disabled", "import", "subprocess"],
260-
default="disabled",
260+
default="auto",
261261
help=(
262262
"Enable the credential lookup via the keyring library if user input is allowed."
263263
" Specify which mechanism to use [disabled, import, subprocess]."

tests/functional/test_install_config.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def auth_needed(request: pytest.FixtureRequest) -> bool:
370370
return request.param
371371

372372

373-
@pytest.fixture(params=("disabled", "import", "subprocess", "auto"))
373+
@pytest.fixture(params=(None, "disabled", "import", "subprocess", "auto"))
374374
def keyring_provider(request: pytest.FixtureRequest) -> str:
375375
return request.param
376376

@@ -389,17 +389,20 @@ def flags(
389389
keyring_provider_implementation: str,
390390
) -> List[str]:
391391
if (
392-
keyring_provider != "auto"
392+
keyring_provider not in [None, "auto"]
393393
and keyring_provider_implementation != keyring_provider
394394
):
395395
pytest.skip()
396396

397-
flags = ["--keyring-provider", keyring_provider]
397+
flags = []
398+
if keyring_provider is not None:
399+
flags.append("--keyring-provider")
400+
flags.append(keyring_provider)
398401
if not interactive:
399402
flags.append("--no-input")
400403
if auth_needed:
401404
if keyring_provider_implementation == "disabled" or (
402-
not interactive and keyring_provider == "auto"
405+
not interactive and keyring_provider in [None, "auto"]
403406
):
404407
request.applymarker(pytest.mark.xfail())
405408
return flags
@@ -441,7 +444,10 @@ def test_prompt_for_keyring_if_needed(
441444
virtualenv = virtualenv_factory(workspace.joinpath("venv"))
442445
script = script_factory(workspace.joinpath("venv"), virtualenv, environ=environ)
443446

444-
if keyring_provider != "auto" or keyring_provider_implementation != "subprocess":
447+
if (
448+
keyring_provider not in [None, "auto"]
449+
or keyring_provider_implementation != "subprocess"
450+
):
445451
script.pip(
446452
"install",
447453
"keyring",

0 commit comments

Comments
 (0)