@@ -32,10 +32,15 @@ def install_plugin(installed: Repository) -> None:
3232 package = ProjectPackage ("poetry-instance" , __version__ )
3333 plugin = Package ("poetry-plugin" , "1.2.3" )
3434
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 ]"
3739 )
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+
3944 system_pyproject_file = SelfCommand .get_default_system_pyproject_file ()
4045 with open (system_pyproject_file , "w" , encoding = "utf-8" , newline = "" ) as f :
4146 f .write (content .as_string ())
@@ -64,7 +69,6 @@ def install_plugin(installed: Repository) -> None:
6469 installed .add_package (plugin )
6570
6671
67- @pytest .mark .xfail (reason = "remove command does not support dependency-groups yet" )
6872def test_remove_installed_package (tester : CommandTester ) -> None :
6973 tester .execute ("poetry-plugin" )
7074
@@ -82,11 +86,9 @@ def test_remove_installed_package(tester: CommandTester) -> None:
8286
8387 dependencies = get_self_command_dependencies ()
8488
85- assert "poetry-plugin" not in dependencies
8689 assert not dependencies
8790
8891
89- @pytest .mark .xfail (reason = "remove command does not support dependency-groups yet" )
9092def test_remove_installed_package_dry_run (tester : CommandTester ) -> None :
9193 tester .execute ("poetry-plugin --dry-run" )
9294
@@ -105,4 +107,6 @@ def test_remove_installed_package_dry_run(tester: CommandTester) -> None:
105107
106108 dependencies = get_self_command_dependencies ()
107109
108- assert "poetry-plugin" in dependencies
110+ assert dependencies
111+ assert len (dependencies ) == 1
112+ assert "poetry-plugin" in dependencies [0 ]
0 commit comments