|
1 | 1 | import pytest |
2 | 2 | import random |
| 3 | +from pypi_simple import PyPISimple |
3 | 4 | from urllib.parse import urljoin |
4 | 5 |
|
5 | 6 | from pulp_python.tests.functional.constants import ( |
@@ -109,3 +110,29 @@ def test_new_content_is_published(python_publication_workflow, python_distributi |
109 | 110 | url = urljoin(distro.base_url, "simple/") |
110 | 111 | proper, msgs = ensure_simple(url, {"shelf-reader": releases}) |
111 | 112 | assert proper is True, msgs |
| 113 | + |
| 114 | + |
| 115 | +@pytest.mark.parallel |
| 116 | +def test_non_matching_canonicalized_name( |
| 117 | + python_repo, python_content_factory, python_publication_factory, python_distribution_factory |
| 118 | +): |
| 119 | + """Ensures a package with dists that have non-matching canonicalized names is published.""" |
| 120 | + packages = [] |
| 121 | + filenames = ["msg_parser-1.0.0-py2.py3-none-any.whl", "msg_parser-1.0.0.tar.gz"] |
| 122 | + with PyPISimple() as client: |
| 123 | + page = client.get_project_page("msg-parser") |
| 124 | + for pkg in page.packages: |
| 125 | + if pkg.filename in filenames: |
| 126 | + c = python_content_factory(pkg.filename, url=pkg.url, repository=python_repo) |
| 127 | + if c.filename.endswith(".tar.gz"): |
| 128 | + # The metadata name in the SDist is not the same as the Wheel's name |
| 129 | + assert c.name == "msg_parser" |
| 130 | + else: |
| 131 | + assert c.name == "msg-parser" |
| 132 | + packages.append(c) |
| 133 | + pub = python_publication_factory(repository=python_repo) |
| 134 | + distro = python_distribution_factory(publication=pub) |
| 135 | + |
| 136 | + url = urljoin(distro.base_url, "simple/") |
| 137 | + proper, msgs = ensure_simple(url, {"msg-parser": filenames}) |
| 138 | + assert proper is True, msgs |
0 commit comments