Skip to content

Commit

Permalink
repo/legacy: remove unwanted stubbing of packages
Browse files Browse the repository at this point in the history
This change removes a stubbing change added in 46ae4f5. This change
was incorrect, as the base class already sets package list to an
empty list.

The test case was also incorrect as it forced addition to internal
package list.
  • Loading branch information
abn committed Mar 8, 2024
1 parent 2fc94bf commit 1a6a879
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
12 changes: 0 additions & 12 deletions src/poetry/repositories/legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ def __init__(

super().__init__(name, url.rstrip("/"), config, disable_cache, pool_size)

@property
def packages(self) -> list[Package]:
# LegacyRepository._packages is not populated and other implementations
# implicitly rely on this (e.g. Pool.search via
# LegacyRepository.search). To avoid special-casing Pool or changing
# behavior, we stub and return an empty list.
#
# TODO: Rethinking search behaviour and design.
# Ref: https://github.com/python-poetry/poetry/issues/2446 and
# https://github.com/python-poetry/poetry/pull/6669#discussion_r990874908.
return []

def package(
self, name: str, version: Version, extras: list[str] | None = None
) -> Package:
Expand Down
7 changes: 0 additions & 7 deletions tests/repositories/test_legacy_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,6 @@ def _download(
shutil.copyfile(str(filepath), dest)


def test_packages_property_returns_empty_list() -> None:
repo = MockRepository()
repo._packages = [repo.package("jupyter", Version.parse("1.0.0"))]

assert repo.packages == []


def test_page_relative_links_path_are_correct() -> None:
repo = MockRepository()

Expand Down

0 comments on commit 1a6a879

Please sign in to comment.