Commit 6e84663d by Randy Döring Committed by Bjorn Neergaard

repository: according to PEP 440 pre-releases should be considered "if the only…

repository: according to PEP 440 pre-releases should be considered "if the only available version that satisfies the version specifier is a pre-release" (no special handling of "*" constraint)
parent cfdba439
...@@ -50,9 +50,7 @@ class Repository(AbstractRepository): ...@@ -50,9 +50,7 @@ class Repository(AbstractRepository):
and not allow_prereleases and not allow_prereleases
and not package.is_direct_origin() and not package.is_direct_origin()
): ):
if constraint.is_any(): ignored_pre_release_packages.append(package)
# we need this when all versions of the package are pre-releases
ignored_pre_release_packages.append(package)
continue continue
packages.append(package) packages.append(package)
......
...@@ -213,7 +213,7 @@ def test_find_packages_no_prereleases() -> None: ...@@ -213,7 +213,7 @@ def test_find_packages_no_prereleases() -> None:
@pytest.mark.parametrize( @pytest.mark.parametrize(
["constraint", "count"], [("*", 1), (">=1", 0), (">=19.0.0a0", 1)] ["constraint", "count"], [("*", 1), (">=1", 1), ("<=18", 0), (">=19.0.0a0", 1)]
) )
def test_find_packages_only_prereleases(constraint: str, count: int) -> None: def test_find_packages_only_prereleases(constraint: str, count: int) -> None:
repo = MockRepository() repo = MockRepository()
...@@ -228,13 +228,6 @@ def test_find_packages_only_prereleases(constraint: str, count: int) -> None: ...@@ -228,13 +228,6 @@ def test_find_packages_only_prereleases(constraint: str, count: int) -> None:
assert package.source_url == repo.url assert package.source_url == repo.url
def test_find_packages_only_prereleases_empty_when_not_any() -> None:
repo = MockRepository()
packages = repo.find_packages(Factory.create_dependency("black", ">=1"))
assert len(packages) == 0
@pytest.mark.parametrize( @pytest.mark.parametrize(
["constraint", "expected"], ["constraint", "expected"],
[ [
......
...@@ -87,7 +87,7 @@ def test_find_packages_does_not_select_prereleases_if_not_allowed() -> None: ...@@ -87,7 +87,7 @@ def test_find_packages_does_not_select_prereleases_if_not_allowed() -> None:
@pytest.mark.parametrize( @pytest.mark.parametrize(
["constraint", "count"], [("*", 1), (">=1", 0), (">=19.0.0a0", 1)] ["constraint", "count"], [("*", 1), (">=1", 1), ("<=18", 0), (">=19.0.0a0", 1)]
) )
def test_find_packages_only_prereleases(constraint: str, count: int) -> None: def test_find_packages_only_prereleases(constraint: str, count: int) -> None:
repo = MockRepository() repo = MockRepository()
......
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