Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add more testing for the wheel filename regex #486

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ __pycache__
.idea
.cache
.eggs
venv
67 changes: 66 additions & 1 deletion tests/test_wheelfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,78 @@ def wheel_path(tmpdir):
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
],
)
def test_wheelfile_re(filename, tmpdir):
def test_wheelfile_re_simple(filename, tmpdir):
# Regression test for #208 and #485
path = tmpdir.join(filename)
with WheelFile(str(path), "w") as wf:
assert wf.parsed_filename
assert wf.parsed_filename.group("namever") == "foo-2"


@pytest.mark.parametrize(
"wheel_name_expectations",
# See https://peps.python.org/pep-0427/#file-name-convention for the spec
# List of Tuple[str, expectation]
[
(
"foo-2-py3-none-any.whl",
{
"namever": "foo-2",
"name": "foo",
"ver": "2",
"build": None,
"pyver": "py3",
"abi": "none",
"plat": "any",
},
),
(
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
{
"namever": "foo-2",
"name": "foo",
"ver": "2",
"build": None,
"pyver": "py2.py3",
"abi": "none",
"plat": "manylinux_2_17_x86_64.manylinux2014_x86_64",
},
),
(
"foo-2-3-py3-cp33m-manylinux2014_x86_64.whl",
{
"namever": "foo-2",
"name": "foo",
"ver": "2",
"build": "3",
"pyver": "py3",
"abi": "cp33m",
"plat": "manylinux2014_x86_64",
},
),
(
"foo-2-3.2.3-py3-abi3-manylinux2014_x86_64.whl",
{
"namever": "foo-2",
"name": "foo",
"ver": "2",
"build": "3.2.3",
"pyver": "py3",
"abi": "abi3",
"plat": "manylinux2014_x86_64",
},
),
],
)
def test_wheelfile_re_complex(wheel_name_expectations, tmpdir):
# Regression test for #208 and #485
(filename, expectation) = wheel_name_expectations
path = tmpdir.join(filename)
with WheelFile(str(path), "w") as wf:
assert wf.parsed_filename
assert wf.parsed_filename.groupdict() == expectation


@pytest.mark.parametrize(
"filename",
[
Expand Down