From 0836e48fa071fc04c7d79be806cf230437a168f9 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 17 Mar 2024 10:03:51 +0000 Subject: [PATCH] add a test --- .../single-page/mmcv_torch_releases.html | 104 ++++++++++++++++++ .../test_single_page_repository.py | 12 +- 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 tests/repositories/fixtures/single-page/mmcv_torch_releases.html diff --git a/tests/repositories/fixtures/single-page/mmcv_torch_releases.html b/tests/repositories/fixtures/single-page/mmcv_torch_releases.html new file mode 100644 index 00000000000..dff3ab240c3 --- /dev/null +++ b/tests/repositories/fixtures/single-page/mmcv_torch_releases.html @@ -0,0 +1,104 @@ +../torch1.12.0/mmcv-2.0.0-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc1-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc2-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc3-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.0rc4-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.0.1-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.1-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.0.1-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.1-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.0.1-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.1-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.0.1-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.0.1-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv-2.1.0-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.1.0-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv-2.1.0-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.1.0-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv-2.1.0-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.1.0-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv-2.1.0-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv-2.1.0-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.0-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.1-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.6.2-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.0-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.1-cp39-cp39-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp310-cp310-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp310-cp310-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp37-cp37m-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp37-cp37m-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp38-cp38-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp38-cp38-win_amd64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp39-cp39-manylinux1_x86_64.whl
+../torch1.12.0/mmcv_full-1.7.2-cp39-cp39-win_amd64.whl
diff --git a/tests/repositories/test_single_page_repository.py b/tests/repositories/test_single_page_repository.py index 72ebff00a85..05789690874 100644 --- a/tests/repositories/test_single_page_repository.py +++ b/tests/repositories/test_single_page_repository.py @@ -22,7 +22,7 @@ class MockSinglePageRepository(SinglePageRepository): def __init__(self, page: str) -> None: super().__init__( "single-page", - url=f"http://single-page.foo.bar/{page}.html", + url=f"http://single-page.foo.bar/single/page/repo/{page}.html", disable_cache=True, ) self._lazy_wheel = False @@ -67,3 +67,13 @@ def test_single_page_repository_find_packages() -> None: package = packages[0] assert package.name == dep.name assert package.to_dependency().to_pep_508() == dep.to_pep_508() + + +def test_single_page_repository_get_page_with_relative_links() -> None: + repo = MockSinglePageRepository("mmcv_torch_releases") + + base_path = Path("/single/page/torch1.12.0") + page = repo.get_page("mmcv") + for link in page.links: + path = Path(link.path) + assert path.parent == base_path