Skip to content

Commit

Permalink
Add test: canonicalize_extras
Browse files Browse the repository at this point in the history
Based on the case in jazzband#2004
  • Loading branch information
AndydeCleyre committed Nov 5, 2023
1 parent 337a8d7 commit 8a35773
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2374,6 +2374,45 @@ def test_combine_different_extras_of_the_same_package(
)


def test_canonicalize_extras(pip_conf, runner, tmp_path, make_package, make_wheel):
"""
Ensure extras are written in a consistent format.
"""
pkgs = [
make_package(
"fake-sqlalchemy",
version="0.1",
extras_require={"fake-postgresql_psycoPG2BINARY": ["fake-greenlet"]},
),
make_package(
"fake-greenlet",
version="0.2",
),
]

dists_dir = tmp_path / "dists"
for pkg in pkgs:
make_wheel(pkg, dists_dir)

with open("requirements.in", "w") as req_in:
req_in.write("fake-sqlalchemy[fake-postgresql_psycoPG2BINARY]\n")

out = runner.invoke(
cli,
[
"--output-file",
"-",
"--find-links",
str(dists_dir),
"--no-header",
"--no-emit-options",
"--no-annotate",
],
)
assert out.exit_code == 0
assert out.stdout == "fake-sqlalchemy[fake-postgresql-psycopg2binary]==0.1\n"


@pytest.mark.parametrize(
("pkg2_install_requires", "req_in_content", "out_expected_content"),
(
Expand Down

0 comments on commit 8a35773

Please sign in to comment.