-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
print a future warning that poetry-plugin-export will not be installe…
…d by default anymore (#8562)
- Loading branch information
Showing
8 changed files
with
83 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
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
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,21 @@ | ||
from __future__ import annotations | ||
|
||
from poetry_plugin_export.command import ( # type: ignore[import-untyped] | ||
ExportCommand as BaseExportCommand, | ||
) | ||
|
||
|
||
class ExportCommand(BaseExportCommand): # type: ignore[misc] | ||
def handle(self) -> int: | ||
if self.poetry.config.get("warnings.export"): | ||
self.line_error( | ||
"Warning: poetry-plugin-export will not be installed by default in a" | ||
" future version of Poetry.\n" | ||
"In order to avoid a breaking change and make your automation" | ||
" forward-compatible, please install poetry-plugin-export explicitly." | ||
" See https://python-poetry.org/docs/plugins/#using-plugins for details" | ||
" on how to install a plugin.\n" | ||
"To disable this warning run 'poetry config warnings.export false'.", | ||
style="warning", | ||
) | ||
return super().handle() # type: ignore[no-any-return] |
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,31 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import pytest | ||
|
||
|
||
if TYPE_CHECKING: | ||
from cleo.testers.command_tester import CommandTester | ||
|
||
from tests.conftest import Config | ||
from tests.types import CommandTesterFactory | ||
|
||
|
||
@pytest.fixture | ||
def tester(command_tester_factory: CommandTesterFactory) -> CommandTester: | ||
return command_tester_factory("export") | ||
|
||
|
||
def test_export_prints_warning(tester: CommandTester) -> None: | ||
tester.execute("") | ||
assert ( | ||
"Warning: poetry-plugin-export will not be installed by default" | ||
in tester.io.fetch_error() | ||
) | ||
|
||
|
||
def test_disable_export_warning(tester: CommandTester, config: Config) -> None: | ||
config.config["warnings"]["export"] = False | ||
tester.execute("") | ||
assert "poetry-plugin-export" not in tester.io.fetch_error() |