diff --git a/tests/console/commands/self/test_remove_plugins.py b/tests/console/commands/self/test_remove_plugins.py index 2b988443469..3c5725109e8 100644 --- a/tests/console/commands/self/test_remove_plugins.py +++ b/tests/console/commands/self/test_remove_plugins.py @@ -4,6 +4,7 @@ import pytest import tomlkit +from tomlkit.toml_file import TOMLFile from poetry.core.packages.dependency import Dependency from poetry.core.packages.package import Package @@ -37,7 +38,8 @@ def install_plugin(installed: Repository) -> None: ) content = Factory.create_pyproject_from_package(package) system_pyproject_file = SelfCommand.get_default_system_pyproject_file() - system_pyproject_file.write_text(content.as_string(), encoding="utf-8") + toml_file = TOMLFile(system_pyproject_file) + toml_file.write(content) lock_content = { "package": [