diff --git a/src/poetry/installation/installer.py b/src/poetry/installation/installer.py index 287a180a111..e3cdcb9e0ed 100644 --- a/src/poetry/installation/installer.py +++ b/src/poetry/installation/installer.py @@ -201,6 +201,8 @@ def _do_refresh(self) -> int: self._io, ) + # Always re-solve directory dependencies, otherwise we can't determine + # if anything has changed (and the lock file contains an invalid version). use_latest = [ p.name for p in locked_repository.packages if p.source_type == "directory" ] diff --git a/tests/console/commands/test_lock.py b/tests/console/commands/test_lock.py index 7f78a22ec67..a8ef7c2aac9 100644 --- a/tests/console/commands/test_lock.py +++ b/tests/console/commands/test_lock.py @@ -179,6 +179,12 @@ def test_lock_no_update_path_dependencies( poetry_with_nested_path_deps_old_lockfile: Poetry, repo: TestRepository, ): + """ + The lock file contains a variant of the directory dependency "quix" that does + not depend on "sampleproject". Although the version of "quix" has not been changed, + it should be re-solved because there is always only one valid version + of a directory dependency at any time. + """ repo.add_package(get_package("sampleproject", "1.3.1")) locker = Locker(