Commit a9ac06f8 by Riccardo Albertazzi Committed by GitHub

test: check that invalid package names are filtered out (#7980)

parent e1344efd
<!DOCTYPE html>
<html>
<head>
<title>Links for pytest</title>
</head>
<body>
<h1>Links for pytest</h1>
<a href="https://files.pythonhosted.org/packages/ed/96/271c93f75212c06e2a7ec3e2fa8a9c90acee0a4838dc05bf379ea09aae31/pytest-3.5.0-py2.py3-none-any.whl#sha256=6266f87ab64692112e5477eba395cfedda53b1933ccd29478e671e73b420c19c"
data-requires-python="&gt;=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*">pytest-3.5.0-py2.py3-none-any.whl</a><br />
<a href="https://files.pythonhosted.org/packages/2d/56/6019153cdd743300c5688ab3b07702355283e53c83fbf922242c053ffb7b/pytest-3.5.0.tar.gz#sha256=fae491d1874f199537fd5872b5e1f0e74a009b979df9d53d1553fd03da1703e1"
data-requires-python="&gt;=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*">pytest-3.5.0.tar.gz</a><br />
<a href="https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl#sha256=ec0a6cb848cc212002b9828c3e34c675e0c9ff6741dc445cab6fdd4e1085d1f1"
data-requires-python="&gt;=2.6, &lt;3">futures-3.2.0-py2-none-any.whl</a><br />
<a href="https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl#sha256=ec0a6cb848cc212002b9828c3e34c675e0c9ff6741dc445cab6fdd4e1085d1f1"
data-requires-python="&gt;=2.6, &lt;3">pytest-3.10.0-py2.py3-none-any.whl</a><br />
<a href="https://files.pythonhosted.org/packages/2d/99/b2c4e9d5a30f6471e410a146232b4118e697fa3ffc06d6a65efde84debd0/futures-3.2.0-py2-none-any.whl#sha256=ec0a6cb848cc212002b9828c3e34c675e0c9ff6741dc445cab6fdd4e1085d1f1"
data-requires-python="&gt;=2.6, &lt;3">pytest-3.5.0-py2.py3-none-any.whl</a><br />
</body>
</html>
<!--SERIAL 7198641-->
...@@ -115,6 +115,30 @@ def test_page_invalid_version_link() -> None: ...@@ -115,6 +115,30 @@ def test_page_invalid_version_link() -> None:
assert packages[0].version.to_string() == "0.1.0" assert packages[0].version.to_string() == "0.1.0"
def test_page_filters_out_invalid_package_names() -> None:
class SpecialMockRepository(MockRepository):
def _get_page(self, name: NormalizedName) -> SimpleRepositoryPage:
return super()._get_page(canonicalize_name(f"{name}-with-extra-packages"))
repo = SpecialMockRepository()
packages = repo.find_packages(Factory.create_dependency("pytest", "*"))
assert len(packages) == 1
assert packages[0].name == "pytest"
assert packages[0].version == Version.parse("3.5.0")
package = repo.package("pytest", Version.parse("3.5.0"))
assert package.files == [
{
"file": "pytest-3.5.0-py2.py3-none-any.whl",
"hash": "sha256:6266f87ab64692112e5477eba395cfedda53b1933ccd29478e671e73b420c19c", # noqa: E501
},
{
"file": "pytest-3.5.0.tar.gz",
"hash": "sha256:fae491d1874f199537fd5872b5e1f0e74a009b979df9d53d1553fd03da1703e1", # noqa: E501
},
]
def test_sdist_format_support() -> None: def test_sdist_format_support() -> None:
repo = MockRepository() repo = MockRepository()
page = repo.get_page("relative") page = repo.get_page("relative")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment