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
5dab851d
Unverified
Commit
5dab851d
authored
Apr 30, 2023
by
David Hotham
Committed by
GitHub
Apr 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parse extras correctly at 'poetry add' (#7836)
parent
22efbade
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletions
+53
-1
src/poetry/console/commands/add.py
+1
-1
tests/console/commands/test_add.py
+52
-0
No files found.
src/poetry/console/commands/add.py
View file @
5dab851d
...
...
@@ -192,7 +192,7 @@ The add command adds required packages to your <comment>pyproject.toml</> and in
for
extra
in
self
.
option
(
"extras"
):
extras
+=
extra
.
split
()
constraint
[
"extras"
]
=
self
.
option
(
"extras"
)
constraint
[
"extras"
]
=
extras
if
self
.
option
(
"editable"
):
if
"git"
in
_constraint
or
"path"
in
_constraint
:
...
...
tests/console/commands/test_add.py
View file @
5dab851d
...
...
@@ -1415,3 +1415,55 @@ def test_add_with_path_dependency_no_loopiness(
with
pytest
.
raises
(
SolverProblemError
):
tester
.
execute
(
"requests"
)
def
test_add_extras_are_parsed_and_included
(
app
:
PoetryTestApplication
,
repo
:
TestRepository
,
tester
:
CommandTester
,
)
->
None
:
msgpack_dep
=
get_dependency
(
"msgpack-python"
,
">=0.5 <0.6"
,
optional
=
True
)
redis_dep
=
get_dependency
(
"redis"
,
">=3.3.6 <4.0.0"
,
optional
=
True
)
cachy
=
get_package
(
"cachy"
,
"0.2.0"
)
cachy
.
add_dependency
(
msgpack_dep
)
cachy
.
add_dependency
(
redis_dep
)
cachy
.
extras
=
{
canonicalize_name
(
"redis"
):
[
redis_dep
],
canonicalize_name
(
"msgpack"
):
[
msgpack_dep
],
}
repo
.
add_package
(
cachy
)
msgpack
=
get_package
(
"msgpack-python"
,
"0.5.1"
)
repo
.
add_package
(
msgpack
)
redis
=
get_package
(
"redis"
,
"3.4.0"
)
repo
.
add_package
(
redis
)
tester
.
execute
(
'cachy --extras "redis msgpack"'
)
expected
=
"""
\
Using version ^0.2.0 for cachy
Updating dependencies
Resolving dependencies...
Package operations: 3 installs, 0 updates, 0 removals
• Installing msgpack-python (0.5.1)
• Installing redis (3.4.0)
• Installing cachy (0.2.0)
Writing lock file
"""
assert
tester
.
io
.
fetch_output
()
==
expected
pyproject
:
dict
[
str
,
Any
]
=
app
.
poetry
.
file
.
read
()
content
=
pyproject
[
"tool"
][
"poetry"
]
assert
"cachy"
in
content
[
"dependencies"
]
assert
content
[
"dependencies"
][
"cachy"
]
==
{
"version"
:
"^0.2.0"
,
"extras"
:
[
"redis"
,
"msgpack"
],
}
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