also lowercase when normalizing micropip package names (#2445)

This commit is contained in:
Nicholas Bollweg 2022-05-02 14:33:40 -05:00 committed by GitHub
parent e3e3c193a2
commit 7152cea01d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -33,7 +33,7 @@ def _format_table(headers: list[str], table: list[Iterable]) -> str:
def normalize_package_name(pkgname: str):
return re.sub(r"[^\w\d.]+", "_", pkgname, re.UNICODE)
return re.sub(r"[^\w\d.]+", "_", pkgname, re.UNICODE).lower()
@dataclass

View File

@ -405,10 +405,9 @@ def test_list_wheel_name_mismatch(monkeypatch):
pytest.importorskip("packaging")
from micropip import _micropip
dummy_pkg_name = "dummy-dummy"
dummy_url = (
f"https://dummy.com/{dummy_pkg_name.replace('-', '_')}-1.0.0-py3-none-any.whl"
)
dummy_pkg_name = "dummy-Dummy"
normalized_pkg_name = dummy_pkg_name.replace("-", "_").lower()
dummy_url = f"https://dummy.com/{normalized_pkg_name}-1.0.0-py3-none-any.whl"
_mock_fetch_bytes = mock_fetch_bytes(dummy_pkg_name, f"Name: {dummy_pkg_name}")
monkeypatch.setattr(_micropip, "fetch_bytes", _mock_fetch_bytes)