Skip to content

Commit

Permalink
tests: add test for poetry show with multiple constraints dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering authored and neersighted committed Oct 29, 2022
1 parent 4a07b5e commit 9df21a7
Showing 1 changed file with 97 additions and 0 deletions.
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

0 comments on commit 9df21a7

Please sign in to comment.