Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
a9fade8a
Commit
a9fade8a
authored
May 26, 2022
by
Mathieu Kniewallner
Committed by
Arun Babu Neelicattu
May 27, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(commands/show): canonicalize package name when looking for existing packages
parent
f945937c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletions
+44
-1
src/poetry/console/commands/show.py
+2
-1
tests/console/commands/test_show.py
+42
-0
No files found.
src/poetry/console/commands/show.py
View file @
a9fade8a
...
...
@@ -10,6 +10,7 @@ from poetry.core.packages.file_dependency import FileDependency
from
poetry.core.packages.vcs_dependency
import
VCSDependency
from
poetry.console.commands.group_command
import
GroupCommand
from
poetry.utils.helpers
import
canonicalize_name
if
TYPE_CHECKING
:
...
...
@@ -148,7 +149,7 @@ lists all packages available."""
if
package
:
pkg
=
None
for
locked
in
locked_packages
:
if
package
.
lower
(
)
==
locked
.
name
:
if
canonicalize_name
(
package
)
==
locked
.
name
:
pkg
=
locked
break
...
...
tests/console/commands/test_show.py
View file @
a9fade8a
...
...
@@ -317,6 +317,48 @@ def test_show_basic_with_installed_packages_single(
]
==
[
line
.
strip
()
for
line
in
tester
.
io
.
fetch_output
()
.
splitlines
()]
def
test_show_basic_with_installed_packages_single_canonicalized
(
tester
:
CommandTester
,
poetry
:
Poetry
,
installed
:
Repository
):
poetry
.
package
.
add_dependency
(
Factory
.
create_dependency
(
"foo-bar"
,
"^0.1.0"
))
foo_bar
=
get_package
(
"foo-bar"
,
"0.1.0"
)
foo_bar
.
description
=
"Foobar package"
installed
.
add_package
(
foo_bar
)
poetry
.
locker
.
mock_lock_data
(
{
"package"
:
[
{
"name"
:
"foo-bar"
,
"version"
:
"0.1.0"
,
"description"
:
"Foobar package"
,
"category"
:
"main"
,
"optional"
:
False
,
"platform"
:
"*"
,
"python-versions"
:
"*"
,
"checksum"
:
[],
},
],
"metadata"
:
{
"python-versions"
:
"*"
,
"platform"
:
"*"
,
"content-hash"
:
"123456789"
,
"hashes"
:
{
"foo-bar"
:
[]},
},
}
)
tester
.
execute
(
"Foo_Bar"
)
assert
[
"name : foo-bar"
,
"version : 0.1.0"
,
"description : Foobar package"
,
]
==
[
line
.
strip
()
for
line
in
tester
.
io
.
fetch_output
()
.
splitlines
()]
def
test_show_basic_with_not_installed_packages_non_decorated
(
tester
:
CommandTester
,
poetry
:
Poetry
,
installed
:
Repository
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment