Skip to content

Commit

Permalink
Merge pull request #11942 from Darsstar/correct-keyring-provider-default
Browse files Browse the repository at this point in the history
Correct keyring provider default
  • Loading branch information
pfmoore authored Apr 10, 2023
2 parents cd7aeb7 + 9605b97 commit 62e932a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Empty file.
2 changes: 1 addition & 1 deletion src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class PipOption(Option):
"--keyring-provider",
dest="keyring_provider",
choices=["auto", "disabled", "import", "subprocess"],
default="disabled",
default="auto",
help=(
"Enable the credential lookup via the keyring library if user input is allowed."
" Specify which mechanism to use [disabled, import, subprocess]."
Expand Down
16 changes: 11 additions & 5 deletions tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def auth_needed(request: pytest.FixtureRequest) -> bool:
return request.param


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

Expand All @@ -389,17 +389,20 @@ def flags(
keyring_provider_implementation: str,
) -> List[str]:
if (
keyring_provider != "auto"
keyring_provider not in [None, "auto"]
and keyring_provider_implementation != keyring_provider
):
pytest.skip()

flags = ["--keyring-provider", keyring_provider]
flags = []
if keyring_provider is not None:
flags.append("--keyring-provider")
flags.append(keyring_provider)
if not interactive:
flags.append("--no-input")
if auth_needed:
if keyring_provider_implementation == "disabled" or (
not interactive and keyring_provider == "auto"
not interactive and keyring_provider in [None, "auto"]
):
request.applymarker(pytest.mark.xfail())
return flags
Expand Down Expand Up @@ -441,7 +444,10 @@ def test_prompt_for_keyring_if_needed(
virtualenv = virtualenv_factory(workspace.joinpath("venv"))
script = script_factory(workspace.joinpath("venv"), virtualenv, environ=environ)

if keyring_provider != "auto" or keyring_provider_implementation != "subprocess":
if (
keyring_provider not in [None, "auto"]
or keyring_provider_implementation != "subprocess"
):
script.pip(
"install",
"keyring",
Expand Down

0 comments on commit 62e932a

Please sign in to comment.