Skip to content

Commit

Permalink
avoid private tomlkit method
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored and neersighted committed Jul 13, 2022
1 parent 879a144 commit 45a1a3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/poetry/console/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ def handle(self) -> int:
section = poetry_content["dependencies"]
else:
if "group" not in poetry_content:
poetry_content.value._insert_after(
"dependencies", "group", table(is_super_table=True)
)
poetry_content["group"] = table(is_super_table=True)

groups = poetry_content["group"]
if group not in groups:
Expand Down
12 changes: 3 additions & 9 deletions tests/console/commands/test_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def test_remove_without_specific_group_removes_from_all_groups(
"""
)
content["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
content["tool"]["poetry"].value._insert_after(
"dependencies", "group", groups_content["tool"]["poetry"]["group"]
)
content["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
app.poetry.file.write(content)

app.poetry.package.add_dependency(Factory.create_dependency("foo", "^2.0.0"))
Expand Down Expand Up @@ -128,9 +126,7 @@ def test_remove_without_specific_group_removes_from_specific_groups(
"""
)
content["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
content["tool"]["poetry"].value._insert_after(
"dependencies", "group", groups_content["tool"]["poetry"]["group"]
)
content["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
app.poetry.file.write(content)

app.poetry.package.add_dependency(Factory.create_dependency("foo", "^2.0.0"))
Expand Down Expand Up @@ -189,9 +185,7 @@ def test_remove_does_not_live_empty_groups(
"""
)
content["tool"]["poetry"]["dependencies"]["foo"] = "^2.0.0"
content["tool"]["poetry"].value._insert_after(
"dependencies", "group", groups_content["tool"]["poetry"]["group"]
)
content["tool"]["poetry"]["group"] = groups_content["tool"]["poetry"]["group"]
app.poetry.file.write(content)

app.poetry.package.add_dependency(Factory.create_dependency("foo", "^2.0.0"))
Expand Down

0 comments on commit 45a1a3b

Please sign in to comment.