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

flatten test parameterization as requested in #3338 #1

Open
wants to merge 2 commits into
base: issue/3320-wheel-file-re
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions poetry/utils/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@


wheel_file_re = re.compile(
r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
\.whl|\.dist-info)$""",
r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))"
r"(-(?P<build>\d.*?))?"
r"-(?P<pyver>.+?)"
r"-(?P<abi>.+?)"
r"-(?P<plat>.+?)"
r"\.whl|\.dist-info$",
re.VERBOSE,
)
41 changes: 41 additions & 0 deletions tests/utils/test_patterns.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import pytest

from poetry.utils import patterns


@pytest.mark.parametrize(
["filename", "namever", "name", "ver", "build", "pyver", "abi", "plat"],
[
(
"markdown_captions-2-py3-none-any.whl",
"markdown_captions-2",
"markdown_captions",
"2",
None,
"py3",
"none",
"any",
),
(
"SQLAlchemy-1.3.20-cp27-cp27mu-manylinux2010_x86_64.whl",
"SQLAlchemy-1.3.20",
"SQLAlchemy",
"1.3.20",
None,
"cp27",
"cp27mu",
"manylinux2010_x86_64",
),
],
)
def test_wheel_file_re(filename, namever, name, ver, build, pyver, abi, plat):
match = patterns.wheel_file_re.match(filename)
groups = match.groupdict()

assert groups["namever"] == namever
assert groups["name"] == name
assert groups["ver"] == ver
assert groups["build"] == build
assert groups["pyver"] == pyver
assert groups["abi"] == abi
assert groups["plat"] == plat