Skip to content

Commit 97ae3ab

Browse files
committed
Clarify message about inconsistent lock file
As discussed in python-poetry#8737 (comment)
1 parent 5f1d1a7 commit 97ae3ab

6 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/poetry/console/commands/check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def handle(self) -> int:
147147
check_result["errors"] += ["poetry.lock was not found."]
148148
if self.poetry.locker.is_locked() and not self.poetry.locker.is_fresh():
149149
check_result["errors"] += [
150-
"poetry.lock is not consistent with pyproject.toml. Run `poetry"
151-
" lock [--no-update]` to fix it."
150+
"pyproject.toml changed significantly since poetry.lock was last generated. Run `poetry"
151+
" lock [--no-update]` to fix the lock file."
152152
]
153153

154154
if not check_result["errors"] and not check_result["warnings"]:

src/poetry/console/commands/lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def handle(self) -> int:
4444
return 0
4545
self.line_error(
4646
"<error>"
47-
"Error: poetry.lock is not consistent with pyproject.toml. "
48-
"Run `poetry lock [--no-update]` to fix it."
47+
"Error: pyproject.toml changed significantly since poetry.lock was last generated. "
48+
"Run `poetry lock [--no-update]` to fix the lock file."
4949
"</error>"
5050
)
5151
return 1

src/poetry/installation/installer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ def _do_install(self) -> int:
246246

247247
if not self._locker.is_fresh():
248248
raise ValueError(
249-
"poetry.lock is not consistent with pyproject.toml. "
250-
"Run `poetry lock [--no-update]` to fix it."
249+
"pyproject.toml changed significantly since poetry.lock was last generated. "
250+
"Run `poetry lock [--no-update]` to fix the lock file."
251251
)
252252

253253
locker_extras = {

tests/console/commands/test_check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ def test_check_lock_outdated(
171171
tester = command_tester_factory("check", poetry=poetry_with_outdated_lockfile)
172172
status_code = tester.execute(options)
173173
expected = (
174-
"Error: poetry.lock is not consistent with pyproject.toml. "
175-
"Run `poetry lock [--no-update]` to fix it.\n"
174+
"Error: pyproject.toml changed significantly since poetry.lock was last generated. "
175+
"Run `poetry lock [--no-update]` to fix the lock file.\n"
176176
)
177177

178178
assert tester.io.fetch_error() == expected

tests/console/commands/test_lock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ def test_lock_check_outdated_legacy(
106106
status_code = tester.execute("--check")
107107
expected = (
108108
"poetry lock --check is deprecated, use `poetry check --lock` instead.\n"
109-
"Error: poetry.lock is not consistent with pyproject.toml. "
110-
"Run `poetry lock [--no-update]` to fix it.\n"
109+
"Error: pyproject.toml changed significantly since poetry.lock was last generated. "
110+
"Run `poetry lock [--no-update]` to fix the lock file.\n"
111111
)
112112

113113
assert tester.io.fetch_error() == expected

tests/installation/test_installer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,8 @@ def test_not_fresh_lock(installer: Installer, locker: Locker) -> None:
220220
with pytest.raises(
221221
ValueError,
222222
match=re.escape(
223-
"poetry.lock is not consistent with pyproject.toml. "
224-
"Run `poetry lock [--no-update]` to fix it."
223+
"pyproject.toml changed significantly since poetry.lock was last generated. "
224+
"Run `poetry lock [--no-update]` to fix the lock file."
225225
),
226226
):
227227
installer.run()

0 commit comments

Comments
 (0)