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: Expand testing for wheel multi-version multi-platform #608

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ _build/
build/
dist/
htmlcov/
venv
brettcannon marked this conversation as resolved.
Show resolved Hide resolved
34 changes: 33 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,24 @@ def test_canonicalize_version_no_strip_trailing_zero(version):
(1000, "abc"),
{Tag("py3", "none", "any")},
),
(
"foo-2-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"foo",
Version("2"),
(),
{
Tag("py2", "none", "manylinux_2_17_x86_64"),
Tag("py2", "none", "manylinux2014_x86_64"),
Tag("py3", "none", "manylinux_2_17_x86_64"),
Tag("py3", "none", "manylinux2014_x86_64"),
},
),
],
)
def test_parse_wheel_filename(filename, name, version, build, tags):
"""
See https://peps.python.org/pep-0427/#file-name-convention for the spec
"""
jacobdr marked this conversation as resolved.
Show resolved Hide resolved
assert parse_wheel_filename(filename) == (name, version, build, tags)


Expand All @@ -113,6 +128,9 @@ def test_parse_wheel_filename(filename, name, version, build, tags):
],
)
def test_parse_wheel_invalid_filename(filename):
"""
See https://peps.python.org/pep-0427/#file-name-convention for the spec
"""
jacobdr marked this conversation as resolved.
Show resolved Hide resolved
with pytest.raises(InvalidWheelFilename):
parse_wheel_filename(filename)

Expand All @@ -122,10 +140,24 @@ def test_parse_wheel_invalid_filename(filename):
[("foo-1.0.tar.gz", "foo", Version("1.0")), ("foo-1.0.zip", "foo", Version("1.0"))],
)
def test_parse_sdist_filename(filename, name, version):
"""
See https://peps.python.org/pep-0625/#specification for the spec
"""
jacobdr marked this conversation as resolved.
Show resolved Hide resolved
assert parse_sdist_filename(filename) == (name, version)


@pytest.mark.parametrize(("filename"), [("foo-1.0.xz"), ("foo1.0.tar.gz")])
@pytest.mark.parametrize(
("filename"),
[
"foo-1.0.xz", # no .tar.gz ending
"foo1.0.tar.gz", # no dash for package name / version separator
"foo", # missing file extension
"foo-1.9", # missing file extension
],
)
def test_parse_sdist_invalid_filename(filename):
"""
See https://peps.python.org/pep-0625/#specification for the spec
"""
jacobdr marked this conversation as resolved.
Show resolved Hide resolved
with pytest.raises(InvalidSdistFilename):
parse_sdist_filename(filename)