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
b6f45426
Unverified
Commit
b6f45426
authored
Jul 19, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix adding existing packages with latest constraint
parent
56543796
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
1 deletions
+37
-1
poetry/console/commands/init.py
+2
-1
tests/console/commands/test_add.py
+35
-0
No files found.
poetry/console/commands/init.py
View file @
b6f45426
...
...
@@ -395,7 +395,8 @@ The <info>init</info> command creates a basic <comment>pyproject.toml</> file in
if
" "
in
pair
:
name
,
version
=
pair
.
split
(
" "
,
2
)
require
[
"name"
]
=
name
require
[
"version"
]
=
version
if
version
!=
"latest"
:
require
[
"version"
]
=
version
else
:
m
=
re
.
match
(
"^([^><=!: ]+)((?:>=|<=|>|<|!=|~=|~|
\
^).*)$"
,
requirement
.
strip
()
...
...
tests/console/commands/test_add.py
View file @
b6f45426
...
...
@@ -601,6 +601,41 @@ def test_add_should_display_an_error_when_adding_existing_package_with_no_constr
assert
"Package foo is already present"
==
str
(
e
.
value
)
def
test_add_should_work_when_adding_existing_package_with_latest_constraint
(
app
,
repo
,
installer
):
content
=
app
.
poetry
.
file
.
read
()
content
[
"tool"
][
"poetry"
][
"dependencies"
][
"foo"
]
=
"^1.0"
app
.
poetry
.
file
.
write
(
content
)
command
=
app
.
find
(
"add"
)
tester
=
CommandTester
(
command
)
repo
.
add_package
(
get_package
(
"foo"
,
"1.1.2"
))
tester
.
execute
(
"foo@latest"
)
expected
=
"""
\
Using version ^1.1.2 for foo
Updating dependencies
Resolving dependencies...
Writing lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing foo (1.1.2)
"""
assert
expected
in
tester
.
io
.
fetch_output
()
content
=
app
.
poetry
.
file
.
read
()[
"tool"
][
"poetry"
]
assert
"foo"
in
content
[
"dependencies"
]
assert
content
[
"dependencies"
][
"foo"
]
==
"^1.1.2"
def
test_add_chooses_prerelease_if_only_prereleases_are_available
(
app
,
repo
,
installer
):
command
=
app
.
find
(
"add"
)
tester
=
CommandTester
(
command
)
...
...
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