Skip to content

Commit f13c20f

Browse files
committed
Add test: canonicalize_extras
Based on the case in #2004
1 parent db1164c commit f13c20f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

tests/test_cli_compile.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2375,6 +2375,49 @@ def test_combine_different_extras_of_the_same_package(
23752375
)
23762376

23772377

2378+
def test_canonicalize_extras(pip_conf, runner, tmp_path, make_package, make_wheel):
2379+
"""
2380+
Ensure extras are written in a consistent format.
2381+
"""
2382+
pkgs = [
2383+
make_package(
2384+
"fake-sqlalchemy",
2385+
version="0.1",
2386+
extras_require={"fake-postgresql_psycoPG2BINARY": ["fake-greenlet"]},
2387+
),
2388+
make_package(
2389+
"fake-greenlet",
2390+
version="0.2",
2391+
),
2392+
]
2393+
2394+
dists_dir = tmp_path / "dists"
2395+
for pkg in pkgs:
2396+
make_wheel(pkg, dists_dir)
2397+
2398+
with open("requirements.in", "w") as req_in:
2399+
req_in.write("fake-sqlalchemy[FAKE_postgresql-psycopg2binary]\n")
2400+
2401+
out = runner.invoke(
2402+
cli,
2403+
[
2404+
"--output-file",
2405+
"-",
2406+
"--find-links",
2407+
str(dists_dir),
2408+
"--no-header",
2409+
"--no-emit-options",
2410+
"--no-annotate",
2411+
"--no-strip-extras",
2412+
],
2413+
)
2414+
assert out.exit_code == 0
2415+
assert (
2416+
"fake-sqlalchemy[fake-postgresql-psycopg2binary]==0.1"
2417+
in out.stdout.splitlines()
2418+
)
2419+
2420+
23782421
@pytest.mark.parametrize(
23792422
("pkg2_install_requires", "req_in_content", "out_expected_content"),
23802423
(

0 commit comments

Comments
 (0)