-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Remove only targetted package (#220)
Fix an issue where all default dependencies were removed instead of just the selected one (fixes #4632)
- Loading branch information
1 parent
5994fa8
commit 0362ffb
Showing
2 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from poetry.core.packages.dependency import Dependency | ||
from poetry.core.packages.dependency_group import DependencyGroup | ||
|
||
|
||
def test_dependency_group_remove_dependency(): | ||
group = DependencyGroup(name="linter") | ||
group.add_dependency(Dependency(name="black", constraint="*")) | ||
group.add_dependency(Dependency(name="isort", constraint="*")) | ||
group.add_dependency(Dependency(name="flake8", constraint="*")) | ||
|
||
assert {dependency.name for dependency in group.dependencies} == { | ||
"black", | ||
"isort", | ||
"flake8", | ||
} | ||
|
||
group.remove_dependency("isort") | ||
assert {dependency.name for dependency in group.dependencies} == {"black", "flake8"} | ||
|
||
group.remove_dependency("black") | ||
assert {dependency.name for dependency in group.dependencies} == {"flake8"} | ||
|
||
group.remove_dependency("flake8") | ||
assert {dependency.name for dependency in group.dependencies} == set() |