Skip to content

Commit b9066d4

Browse files
committed
Add test cases for normalized weird extra
1 parent 2185778 commit b9066d4

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

tests/functional/test_install_extras.py

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,25 +155,50 @@ def test_install_fails_if_extra_at_end(
155155
assert "Extras after version" in result.stderr
156156

157157

158-
def test_install_special_extra(script: PipTestEnvironment) -> None:
158+
@pytest.mark.parametrize(
159+
"specified_extra, requested_extra",
160+
[
161+
("Hop_hOp-hoP", "Hop_hOp-hoP"),
162+
pytest.param(
163+
"Hop_hOp-hoP",
164+
"hop-hop-hop",
165+
marks=pytest.mark.xfail(
166+
reason=(
167+
"matching a normalized extra request against an"
168+
"unnormalized extra in metadata requires PEP 685 support "
169+
"in packaging (see pypa/pip#11445)."
170+
),
171+
),
172+
),
173+
("hop-hop-hop", "Hop_hOp-hoP"),
174+
],
175+
)
176+
def test_install_special_extra(
177+
script: PipTestEnvironment,
178+
specified_extra: str,
179+
requested_extra: str,
180+
) -> None:
159181
# Check that uppercase letters and '-' are dealt with
160182
# make a dummy project
161183
pkga_path = script.scratch_path / "pkga"
162184
pkga_path.mkdir()
163185
pkga_path.joinpath("setup.py").write_text(
164186
textwrap.dedent(
165-
"""
187+
f"""
166188
from setuptools import setup
167189
setup(name='pkga',
168190
version='0.1',
169-
extras_require={'Hop_hOp-hoP': ['missing_pkg']},
191+
extras_require={{'{specified_extra}': ['missing_pkg']}},
170192
)
171193
"""
172194
)
173195
)
174196

175197
result = script.pip(
176-
"install", "--no-index", f"{pkga_path}[Hop_hOp-hoP]", expect_error=True
198+
"install",
199+
"--no-index",
200+
f"{pkga_path}[{requested_extra}]",
201+
expect_error=True,
177202
)
178203
assert (
179204
"Could not find a version that satisfies the requirement missing_pkg"

0 commit comments

Comments
 (0)