From 5e6baebf1534b12e82869d7dbb797954694b551b Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Sat, 10 Feb 2024 09:45:58 -0800 Subject: [PATCH] Clarify message about an outdated lock file As discussed in https://github.com/python-poetry/poetry/pull/8737#discussion_r1479307035 --- src/poetry/console/commands/check.py | 4 ++-- src/poetry/console/commands/lock.py | 4 ++-- src/poetry/installation/installer.py | 4 ++-- tests/console/commands/test_check.py | 4 ++-- tests/console/commands/test_lock.py | 4 ++-- tests/installation/test_installer.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/poetry/console/commands/check.py b/src/poetry/console/commands/check.py index ac75e377d57..7512487be24 100644 --- a/src/poetry/console/commands/check.py +++ b/src/poetry/console/commands/check.py @@ -147,8 +147,8 @@ def handle(self) -> int: check_result["errors"] += ["poetry.lock was not found."] if self.poetry.locker.is_locked() and not self.poetry.locker.is_fresh(): check_result["errors"] += [ - "poetry.lock is not consistent with pyproject.toml. Run `poetry" - " lock [--no-update]` to fix it." + "pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file." ] if not check_result["errors"] and not check_result["warnings"]: diff --git a/src/poetry/console/commands/lock.py b/src/poetry/console/commands/lock.py index b32c05dd4e4..fd8eda77936 100644 --- a/src/poetry/console/commands/lock.py +++ b/src/poetry/console/commands/lock.py @@ -44,8 +44,8 @@ def handle(self) -> int: return 0 self.line_error( "" - "Error: poetry.lock is not consistent with pyproject.toml. " - "Run `poetry lock [--no-update]` to fix it." + "Error: pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file." "" ) return 1 diff --git a/src/poetry/installation/installer.py b/src/poetry/installation/installer.py index 8c2008ee88b..7bc9f23520d 100644 --- a/src/poetry/installation/installer.py +++ b/src/poetry/installation/installer.py @@ -246,8 +246,8 @@ def _do_install(self) -> int: if not self._locker.is_fresh(): raise ValueError( - "poetry.lock is not consistent with pyproject.toml. " - "Run `poetry lock [--no-update]` to fix it." + "pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file." ) locker_extras = { diff --git a/tests/console/commands/test_check.py b/tests/console/commands/test_check.py index eb94772f3ca..7957385d958 100644 --- a/tests/console/commands/test_check.py +++ b/tests/console/commands/test_check.py @@ -171,8 +171,8 @@ def test_check_lock_outdated( tester = command_tester_factory("check", poetry=poetry_with_outdated_lockfile) status_code = tester.execute(options) expected = ( - "Error: poetry.lock is not consistent with pyproject.toml. " - "Run `poetry lock [--no-update]` to fix it.\n" + "Error: pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file.\n" ) assert tester.io.fetch_error() == expected diff --git a/tests/console/commands/test_lock.py b/tests/console/commands/test_lock.py index 26e0b98277c..2eaf9ded478 100644 --- a/tests/console/commands/test_lock.py +++ b/tests/console/commands/test_lock.py @@ -106,8 +106,8 @@ def test_lock_check_outdated_legacy( status_code = tester.execute("--check") expected = ( "poetry lock --check is deprecated, use `poetry check --lock` instead.\n" - "Error: poetry.lock is not consistent with pyproject.toml. " - "Run `poetry lock [--no-update]` to fix it.\n" + "Error: pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file.\n" ) assert tester.io.fetch_error() == expected diff --git a/tests/installation/test_installer.py b/tests/installation/test_installer.py index 674e57000fb..8cc8d2a2d91 100644 --- a/tests/installation/test_installer.py +++ b/tests/installation/test_installer.py @@ -220,8 +220,8 @@ def test_not_fresh_lock(installer: Installer, locker: Locker) -> None: with pytest.raises( ValueError, match=re.escape( - "poetry.lock is not consistent with pyproject.toml. " - "Run `poetry lock [--no-update]` to fix it." + "pyproject.toml changed significantly since poetry.lock was last generated. " + "Run `poetry lock [--no-update]` to fix the lock file." ), ): installer.run()