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

show --tree: stop ignoring --no-dev #3296

Merged
merged 2 commits into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion poetry/console/commands/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ def handle(self):

# Show tree view if requested
if self.option("tree") and not package:
requires = self.poetry.package.requires + self.poetry.package.dev_requires
requires = self.poetry.package.requires
if include_dev:
requires += self.poetry.package.dev_requires
packages = locked_repo.packages
for package in packages:
for require in requires:
Expand Down
67 changes: 67 additions & 0 deletions tests/console/commands/test_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,3 +1152,70 @@ def test_show_tree(tester, poetry, installed):
"""

assert expected == tester.io.fetch_output()


def test_show_tree_no_dev(tester, poetry, installed):
poetry.package.add_dependency(Factory.create_dependency("cachy", "^0.2.0"))
poetry.package.add_dependency(
Factory.create_dependency("pytest", "^6.1.0", category="dev")
)

cachy2 = get_package("cachy", "0.2.0")
cachy2.add_dependency(Factory.create_dependency("msgpack-python", ">=0.5 <0.6"))
installed.add_package(cachy2)

pytest = get_package("pytest", "6.1.1")
installed.add_package(pytest)

poetry.locker.mock_lock_data(
{
"package": [
{
"name": "cachy",
"version": "0.2.0",
"description": "",
"category": "main",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
"dependencies": {"msgpack-python": ">=0.5 <0.6"},
},
{
"name": "msgpack-python",
"version": "0.5.1",
"description": "",
"category": "main",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
},
{
"name": "pytest",
"version": "6.1.1",
"description": "",
"category": "dev",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
},
],
"metadata": {
"python-versions": "*",
"platform": "*",
"content-hash": "123456789",
"hashes": {"cachy": [], "msgpack-python": [], "pytest": []},
},
}
)

tester.execute("--tree --no-dev")

expected = """\
cachy 0.2.0
`-- msgpack-python >=0.5 <0.6
"""

assert expected == tester.io.fetch_output()