Skip to content

Commit

Permalink
Merge pull request #2525 from python-poetry/fix-persistent-update-for…
Browse files Browse the repository at this point in the history
…-legacy-repositories-packages

Fix legacy repositories packages being continuously updated
  • Loading branch information
sdispater authored Jun 9, 2020
2 parents ce134ce + 2df5704 commit b6c5c1e
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 b6c5c1e

Please sign in to comment.