Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: add test for poetry show with multiple constraints dependencies #6920

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
97 changes: 97 additions & 0 deletions tests/console/commands/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,103 @@ def test_show_all_shows_incompatible_package(
assert tester.io.fetch_output() == expected


def test_show_hides_incompatible_package_with_duplicate(
tester: CommandTester,
poetry: Poetry,
installed: Repository,
repo: TestRepository,
):
poetry.package.add_dependency(
Factory.create_dependency("cachy", {"version": "0.1.0", "platform": "linux"})
)
poetry.package.add_dependency(
Factory.create_dependency("cachy", {"version": "0.1.1", "platform": "darwin"})
)

poetry.locker.mock_lock_data(
{
"package": [
{
"name": "cachy",
"version": "0.1.0",
"description": "Cachy package",
"optional": False,
"platform": "*",
"python-versions": "*",
"files": [],
},
{
"name": "cachy",
"version": "0.1.1",
"description": "Cachy package",
"optional": False,
"platform": "*",
"python-versions": "*",
"files": [],
},
],
"metadata": {"content-hash": "123456789"},
}
)

tester.execute()

expected = """\
cachy (!) 0.1.1 Cachy package
"""

assert tester.io.fetch_output() == expected


def test_show_all_shows_all_duplicates(
tester: CommandTester,
poetry: Poetry,
installed: Repository,
repo: TestRepository,
):
poetry.package.add_dependency(
Factory.create_dependency("cachy", {"version": "0.1.0", "platform": "linux"})
)
poetry.package.add_dependency(
Factory.create_dependency("cachy", {"version": "0.1.1", "platform": "darwin"})
)

poetry.locker.mock_lock_data(
{
"package": [
{
"name": "cachy",
"version": "0.1.0",
"description": "Cachy package",
"optional": False,
"platform": "*",
"python-versions": "*",
"files": [],
},
{
"name": "cachy",
"version": "0.1.1",
"description": "Cachy package",
"optional": False,
"platform": "*",
"python-versions": "*",
"files": [],
},
],
"metadata": {"content-hash": "123456789"},
}
)

tester.execute("--all")

expected = """\
cachy 0.1.0 Cachy package
cachy (!) 0.1.1 Cachy package
"""

assert tester.io.fetch_output() == expected


def test_show_non_dev_with_basic_installed_packages(
tester: CommandTester, poetry: Poetry, installed: Repository
):
Expand Down