Commit 8a7764f5 by Sébastien Eustace Committed by GitHub

Fix git dependencies prereleases resolution (#1458)

parent af71f6c0
......@@ -64,7 +64,13 @@ class Repository(BaseRepository):
for package in self.packages:
if name == package.name:
if package.is_prerelease() and not allow_prereleases:
if (
package.is_prerelease()
and not allow_prereleases
and not package.source_type
):
# If prereleases are not allowed and the package is a prerelease
# and is a standard package then we skip it
continue
if constraint.allows(package.version):
......
......@@ -81,7 +81,7 @@ def mock_clone(_, source, dest):
parts = urlparse.urlparse(source)
folder = (
Path(__file__).parent.parent
Path(__file__).parent
/ "fixtures"
/ "git"
/ parts.netloc
......@@ -91,7 +91,6 @@ def mock_clone(_, source, dest):
if dest.exists():
shutil.rmtree(str(dest))
shutil.rmtree(str(dest))
shutil.copytree(str(folder), str(dest))
......
[tool.poetry]
name = "prerelease"
version = "1.0.0.dev0"
description = "Some description."
authors = [
"Sébastien Eustace <sebastien@eustace.io>"
]
license = "MIT"
# Requirements
[tool.poetry.dependencies]
python = "~2.7 || ^3.4"
[tool.poetry.dev-dependencies]
......@@ -1529,3 +1529,31 @@ def test_run_installs_with_url_file(installer, locker, repo, package):
assert locker.written_data == expected
assert len(installer.installer.installs) == 2
def test_installer_uses_prereleases_if_they_are_compatible(
installer, locker, package, repo
):
package.python_versions = "~2.7 || ^3.4"
package.add_dependency(
"prerelease", {"git": "https://github.com/demo/prerelease.git"}
)
package_b = get_package("b", "2.0.0")
package_b.add_dependency("prerelease", ">=0.19")
repo.add_package(package_b)
installer.run()
del installer.installer.installs[:]
locker.locked(True)
locker.mock_lock_data(locker.written_data)
package.add_dependency("b", "^2.0.0")
installer.whitelist(["b"])
installer.update(True)
installer.run()
assert len(installer.installer.installs) == 2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment