From 0d646e2e30126f5eab1c022e8d71c434805e7153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Eustace?= Date: Fri, 5 Jun 2020 12:43:02 +0200 Subject: [PATCH] Fix legacy repositories information not being set on packages (#2484) --- poetry/repositories/legacy_repository.py | 3 +++ tests/repositories/test_legacy_repository.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/poetry/repositories/legacy_repository.py b/poetry/repositories/legacy_repository.py index 4bb0496eb29..f850c29c85a 100644 --- a/poetry/repositories/legacy_repository.py +++ b/poetry/repositories/legacy_repository.py @@ -269,6 +269,8 @@ def find_packages( for version in versions: package = Package(name, version) + package.source_type = "legacy" + package.source_reference = self.name package.source_url = self._url if extras is not None: @@ -313,6 +315,7 @@ def package( if release_info["requires_python"]: package.python_versions = release_info["requires_python"] + package.source_type = "legacy" package.source_url = self._url package.source_reference = self.name diff --git a/tests/repositories/test_legacy_repository.py b/tests/repositories/test_legacy_repository.py index 3803da552ce..43aa8aae028 100644 --- a/tests/repositories/test_legacy_repository.py +++ b/tests/repositories/test_legacy_repository.py @@ -84,6 +84,9 @@ def test_get_package_information_fallback_read_setup(): package = repo.package("jupyter", "1.0.0") + assert package.source_type == "legacy" + assert package.source_reference == repo.name + assert package.source_url == repo.url assert package.name == "jupyter" assert package.version.text == "1.0.0" assert ( @@ -142,6 +145,10 @@ def test_find_packages_no_prereleases(): assert len(packages) == 1 + assert packages[0].source_type == "legacy" + assert packages[0].source_reference == repo.name + assert packages[0].source_url == repo.url + def test_get_package_information_chooses_correct_distribution(): repo = MockRepository()