@@ -32,10 +32,15 @@ def install_plugin(installed: Repository) -> None:
32
32
package = ProjectPackage ("poetry-instance" , __version__ )
33
33
plugin = Package ("poetry-plugin" , "1.2.3" )
34
34
35
- package .add_dependency (
36
- Dependency (plugin .name , "^1.2.3" , groups = [SelfCommand .ADDITIONAL_PACKAGE_GROUP ])
35
+ content = Factory .create_legacy_pyproject_from_package (package )
36
+ content ["dependency-groups" ] = tomlkit .table ()
37
+ content ["dependency-groups" ][SelfCommand .ADDITIONAL_PACKAGE_GROUP ] = tomlkit .array ( # type: ignore[index]
38
+ "[\n ]"
37
39
)
38
- content = Factory .create_pyproject_from_package (package )
40
+ content ["dependency-groups" ][SelfCommand .ADDITIONAL_PACKAGE_GROUP ].append ( # type: ignore[index, union-attr, call-arg]
41
+ Dependency (plugin .name , "^1.2.3" ).to_pep_508 ()
42
+ )
43
+
39
44
system_pyproject_file = SelfCommand .get_default_system_pyproject_file ()
40
45
with open (system_pyproject_file , "w" , encoding = "utf-8" , newline = "" ) as f :
41
46
f .write (content .as_string ())
@@ -64,7 +69,6 @@ def install_plugin(installed: Repository) -> None:
64
69
installed .add_package (plugin )
65
70
66
71
67
- @pytest .mark .xfail (reason = "remove command does not support dependency-groups yet" )
68
72
def test_remove_installed_package (tester : CommandTester ) -> None :
69
73
tester .execute ("poetry-plugin" )
70
74
@@ -82,11 +86,9 @@ def test_remove_installed_package(tester: CommandTester) -> None:
82
86
83
87
dependencies = get_self_command_dependencies ()
84
88
85
- assert "poetry-plugin" not in dependencies
86
89
assert not dependencies
87
90
88
91
89
- @pytest .mark .xfail (reason = "remove command does not support dependency-groups yet" )
90
92
def test_remove_installed_package_dry_run (tester : CommandTester ) -> None :
91
93
tester .execute ("poetry-plugin --dry-run" )
92
94
@@ -105,4 +107,6 @@ def test_remove_installed_package_dry_run(tester: CommandTester) -> None:
105
107
106
108
dependencies = get_self_command_dependencies ()
107
109
108
- assert "poetry-plugin" in dependencies
110
+ assert dependencies
111
+ assert len (dependencies ) == 1
112
+ assert "poetry-plugin" in dependencies [0 ]
0 commit comments