Skip to content

Commit

Permalink
Clarify message about an outdated lock file
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr authored and radoering committed Feb 13, 2024
1 parent 4ed5e1a commit 5e6baeb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/poetry/console/commands/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/console/commands/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def handle(self) -> int:
return 0
self.line_error(
"<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."
"</error>"
)
return 1
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/installation/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 2 additions & 2 deletions tests/console/commands/test_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/console/commands/test_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/installation/test_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 5e6baeb

Please sign in to comment.