Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repository: PEP 440 pre-release handling #7225

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/poetry/repositories/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ def find_packages(self, dependency: Dependency) -> list[Package]:
and not allow_prereleases
and not package.is_direct_origin()
):
if constraint.is_any():
# we need this when all versions of the package are pre-releases
ignored_pre_release_packages.append(package)
ignored_pre_release_packages.append(package)
continue

packages.append(package)
Expand Down
9 changes: 1 addition & 8 deletions tests/repositories/test_legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_find_packages_no_prereleases() -> None:


@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:
repo = MockRepository()
Expand All @@ -228,13 +228,6 @@ def test_find_packages_only_prereleases(constraint: str, count: int) -> None:
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(
["constraint", "expected"],
[
Expand Down
2 changes: 1 addition & 1 deletion tests/repositories/test_pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_find_packages_does_not_select_prereleases_if_not_allowed() -> None:


@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:
repo = MockRepository()
Expand Down