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
9e0d9d5e
Commit
9e0d9d5e
authored
Apr 09, 2021
by
Sébastien Eustace
Committed by
Arun Babu Neelicattu
Apr 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix reverting the pyproject.toml content in the remove command
parent
00309bee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
8 deletions
+26
-8
poetry/console/commands/remove.py
+2
-8
tests/console/commands/test_remove.py
+24
-0
No files found.
poetry/console/commands/remove.py
View file @
9e0d9d5e
...
@@ -32,7 +32,6 @@ list of installed packages
...
@@ -32,7 +32,6 @@ list of installed packages
packages
=
self
.
argument
(
"packages"
)
packages
=
self
.
argument
(
"packages"
)
is_dev
=
self
.
option
(
"dev"
)
is_dev
=
self
.
option
(
"dev"
)
original_content
=
self
.
poetry
.
file
.
read
()
content
=
self
.
poetry
.
file
.
read
()
content
=
self
.
poetry
.
file
.
read
()
poetry_content
=
content
[
"tool"
][
"poetry"
]
poetry_content
=
content
[
"tool"
][
"poetry"
]
section
=
"dependencies"
section
=
"dependencies"
...
@@ -75,14 +74,9 @@ list of installed packages
...
@@ -75,14 +74,9 @@ list of installed packages
self
.
_installer
.
update
(
True
)
self
.
_installer
.
update
(
True
)
self
.
_installer
.
whitelist
(
requirements
)
self
.
_installer
.
whitelist
(
requirements
)
try
:
status
=
self
.
_installer
.
run
()
status
=
self
.
_installer
.
run
()
except
Exception
:
self
.
poetry
.
file
.
write
(
original_content
)
raise
if
not
self
.
option
(
"dry-run"
)
and
status
==
0
:
if
not
self
.
option
(
"dry-run"
):
self
.
poetry
.
file
.
write
(
content
)
self
.
poetry
.
file
.
write
(
content
)
return
status
return
status
tests/console/commands/test_remove.py
0 → 100644
View file @
9e0d9d5e
import
pytest
from
poetry.core.packages.package
import
Package
@pytest.fixture
()
def
tester
(
command_tester_factory
):
return
command_tester_factory
(
"remove"
)
def
test_remove_command_should_not_write_changes_upon_installer_errors
(
tester
,
app
,
repo
,
command_tester_factory
,
mocker
):
repo
.
add_package
(
Package
(
"foo"
,
"2.0.0"
))
command_tester_factory
(
"add"
)
.
execute
(
"foo"
)
mocker
.
patch
(
"poetry.installation.installer.Installer.run"
,
return_value
=
1
)
original_content
=
app
.
poetry
.
file
.
read
()
.
as_string
()
tester
.
execute
(
"foo"
)
assert
app
.
poetry
.
file
.
read
()
.
as_string
()
==
original_content
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