Skip to content

Commit 46bf998

Browse files
committed
Add failing test for the use case of supplying --no-input and having keyring queried for credentials.
Since there is currently no possible way to get pip to query the keyring when --no-input is used I am not marking the new scenario xfail. That should change once there is some way to do that.
1 parent 7acfc83 commit 46bf998

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/functional/test_install_config.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import ssl
33
import tempfile
44
import textwrap
5+
import typing
56

67
import pytest
78

@@ -352,12 +353,34 @@ def test_do_not_prompt_for_authentication(
352353
assert "ERROR: HTTP error 401" in result.stderr
353354

354355

355-
@pytest.mark.parametrize("auth_needed", (True, False))
356+
@pytest.fixture(params=(True, False), ids=("auth_needed", "auth_not_needed"))
357+
def auth_needed(request: pytest.FixtureRequest) -> bool:
358+
return request.param # type: ignore[attr-defined]
359+
360+
361+
@pytest.fixture(
362+
params=(
363+
False,
364+
True,
365+
),
366+
ids=("default", "no_input"),
367+
)
368+
def flags(request: pytest.FixtureRequest) -> typing.List[str]:
369+
no_input = request.param # type: ignore[attr-defined]
370+
371+
flags = []
372+
if no_input:
373+
flags.append("--no-input")
374+
375+
return flags
376+
377+
356378
def test_prompt_for_keyring_if_needed(
357379
script: PipTestEnvironment,
358380
data: TestData,
359381
cert_factory: CertFactory,
360382
auth_needed: bool,
383+
flags: typing.List[str],
361384
) -> None:
362385
"""Test behaviour while installing from a index url
363386
requiring authentication and keyring is possible.
@@ -408,6 +431,7 @@ def get_credential(url, username):
408431
cert_path,
409432
"--client-cert",
410433
cert_path,
434+
*flags,
411435
"simple",
412436
)
413437

0 commit comments

Comments
 (0)