diff --git a/src/poetry/console/commands/add.py b/src/poetry/console/commands/add.py index 28a2a7bc030..a517e587e39 100644 --- a/src/poetry/console/commands/add.py +++ b/src/poetry/console/commands/add.py @@ -443,8 +443,8 @@ def _hint_update_packages(self) -> str: def notify_about_existing_packages(self, existing_packages: list[str]) -> None: self.line( - "The following packages are already present in the pyproject.toml and will" - " be skipped:\n" + f"The following packages are already present in the pyproject.toml" + f" ({self.poetry.file.path}) and will be skipped:\n" ) for name in existing_packages: self.line(f" - {name}") diff --git a/tests/console/commands/self/test_add_plugins.py b/tests/console/commands/self/test_add_plugins.py index 4e9786fd92d..8b447b5f4bc 100644 --- a/tests/console/commands/self/test_add_plugins.py +++ b/tests/console/commands/self/test_add_plugins.py @@ -203,8 +203,8 @@ def test_add_existing_plugin_warns_about_no_operation( assert isinstance(tester.command, AddCommand) expected = f"""\ -The following packages are already present in the pyproject.toml and will be\ - skipped: +The following packages are already present in the pyproject.toml\ + ({tester.command.poetry.file.path}) and will be skipped: - poetry-plugin {tester.command._hint_update_packages} diff --git a/tests/console/commands/test_add.py b/tests/console/commands/test_add.py index c6352854008..bf1390fd232 100644 --- a/tests/console/commands/test_add.py +++ b/tests/console/commands/test_add.py @@ -1416,8 +1416,9 @@ def test_add_should_skip_when_adding_existing_package_with_no_constraint( repo.add_package(get_package("foo", "1.1.2")) tester.execute("foo") - expected = """\ -The following packages are already present in the pyproject.toml and will be skipped: + expected = f"""\ +The following packages are already present in the pyproject.toml\ + ({app.poetry.file.path}) and will be skipped: - foo @@ -1447,8 +1448,9 @@ def test_add_should_skip_when_adding_canonicalized_existing_package_with_no_cons repo.add_package(get_package("foo-bar", "1.1.2")) tester.execute("Foo_Bar") - expected = """\ -The following packages are already present in the pyproject.toml and will be skipped: + expected = f"""\ +The following packages are already present in the pyproject.toml\ + ({app.poetry.file.path}) and will be skipped: - Foo_Bar