Skip to content

Commit

Permalink
Fix legacy repositories packages being continuously updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Jun 9, 2020
1 parent bc9acdb commit 2df5704
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry/puzzle/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def solve(self, use_latest=None): # type: (...) -> List[Operation]
elif package.version != pkg.version:
# Checking version
operations.append(Update(pkg, package))
elif package.source_type != pkg.source_type:
elif pkg.source_type and package.source_type != pkg.source_type:
operations.append(Update(pkg, package))
else:
operations.append(Install(package).skip("Already installed"))
Expand Down
19 changes: 19 additions & 0 deletions tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2039,3 +2039,22 @@ def test_solver_cannot_choose_another_version_for_url_dependencies(
# via the git dependency
with pytest.raises(SolverProblemError):
solver.solve()


def test_solver_should_not_update_same_version_packages_if_installed_has_no_source_type(
solver, repo, package, installed
):
package.add_dependency("foo", "1.0.0")

foo = get_package("foo", "1.0.0")
foo.source_type = "legacy"
foo.source_reference = "custom"
foo.source_url = "https://foo.bar"
repo.add_package(foo)
installed.add_package(get_package("foo", "1.0.0"))

ops = solver.solve()

check_solver_result(
ops, [{"job": "install", "package": foo, "skipped": True}],
)

0 comments on commit 2df5704

Please sign in to comment.