diff --git a/src/poetry/repositories/legacy_repository.py b/src/poetry/repositories/legacy_repository.py index a6edf66729c..badef735152 100644 --- a/src/poetry/repositories/legacy_repository.py +++ b/src/poetry/repositories/legacy_repository.py @@ -12,7 +12,7 @@ from poetry.inspection.info import PackageInfo from poetry.repositories.exceptions import PackageNotFound from poetry.repositories.http_repository import HTTPRepository -from poetry.repositories.link_sources.html import SimpleRepositoryPage +from poetry.repositories.link_sources.html import HTMLPage, SimpleRepositoryPage from poetry.repositories.link_sources.html import SimpleRepositoryRootPage @@ -125,7 +125,7 @@ def _get_release_info( ), ) - def _get_page(self, name: NormalizedName) -> SimpleRepositoryPage: + def _get_page(self, name: NormalizedName) -> HTMLPage: if not (response := self._get_response(f"/{name}/")): raise PackageNotFound(f"Package [{name}] not found.") return SimpleRepositoryPage(response.url, response.text) diff --git a/src/poetry/repositories/single_page_repository.py b/src/poetry/repositories/single_page_repository.py index 7bdc469bbf0..446957f12db 100644 --- a/src/poetry/repositories/single_page_repository.py +++ b/src/poetry/repositories/single_page_repository.py @@ -4,7 +4,7 @@ from poetry.repositories.exceptions import PackageNotFound from poetry.repositories.legacy_repository import LegacyRepository -from poetry.repositories.link_sources.html import SimpleRepositoryPage +from poetry.repositories.link_sources.html import HTMLPage if TYPE_CHECKING: @@ -12,11 +12,11 @@ class SinglePageRepository(LegacyRepository): - def _get_page(self, name: NormalizedName) -> SimpleRepositoryPage: + def _get_page(self, name: NormalizedName) -> HTMLPage: """ Single page repositories only have one page irrespective of endpoint. """ response = self._get_response("") if not response: raise PackageNotFound(f"Package [{name}] not found.") - return SimpleRepositoryPage(response.url, response.text) + return HTMLPage(response.url, response.text) diff --git a/tests/repositories/fixtures/legacy.py b/tests/repositories/fixtures/legacy.py index 58f431b0268..57c06aee1cb 100644 --- a/tests/repositories/fixtures/legacy.py +++ b/tests/repositories/fixtures/legacy.py @@ -22,7 +22,7 @@ from packaging.utils import NormalizedName from pytest_mock import MockerFixture - from poetry.repositories.link_sources.html import SimpleRepositoryPage + from poetry.repositories.link_sources.html import HTMLPage from tests.types import HTTPrettyRequestCallback from tests.types import NormalizedNameTransformer from tests.types import SpecializedLegacyRepositoryMocker @@ -129,7 +129,7 @@ def mock( ) original_get_page = specialized_repository._get_page - def _mocked_get_page(name: NormalizedName) -> SimpleRepositoryPage: + def _mocked_get_page(name: NormalizedName) -> HTMLPage: return original_get_page( canonicalize_name(f"{name}{transformer_or_suffix}") if isinstance(transformer_or_suffix, str) diff --git a/tests/repositories/fixtures/single-page/relative_links.html b/tests/repositories/fixtures/single-page/relative_links.html new file mode 100644 index 00000000000..092b96ba327 --- /dev/null +++ b/tests/repositories/fixtures/single-page/relative_links.html @@ -0,0 +1,7 @@ + + +
+ +relative-links-0.1.0.tar.gz