From 323fb6cd9010516b8471dc699089700a2e638b4f Mon Sep 17 00:00:00 2001 From: Jacob Roberts Date: Mon, 7 Nov 2022 09:22:47 -0800 Subject: [PATCH 1/5] Add slightly more testing to the wheel and sdist tests. Add venv to the .gitignore --- .gitignore | 1 + tests/test_utils.py | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 05e554a64..4df28a35c 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ _build/ build/ dist/ htmlcov/ +venv diff --git a/tests/test_utils.py b/tests/test_utils.py index a6c6711d1..d3a67db3c 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -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 + """ assert parse_wheel_filename(filename) == (name, version, build, tags) @@ -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 + """ with pytest.raises(InvalidWheelFilename): parse_wheel_filename(filename) @@ -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 + """ 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 + """ with pytest.raises(InvalidSdistFilename): parse_sdist_filename(filename) From 401fe70ef1111fa6bf48e12328ec1bd05757acb6 Mon Sep 17 00:00:00 2001 From: Jacob Roberts Date: Wed, 9 Nov 2022 14:44:56 -0800 Subject: [PATCH 2/5] Update docstring comment format Co-authored-by: Brett Cannon --- tests/test_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index d3a67db3c..847b250ec 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -109,9 +109,7 @@ def test_canonicalize_version_no_strip_trailing_zero(version): ], ) def test_parse_wheel_filename(filename, name, version, build, tags): - """ - See https://peps.python.org/pep-0427/#file-name-convention for the spec - """ + # See https://peps.python.org/pep-0427/#file-name-convention for the spec. assert parse_wheel_filename(filename) == (name, version, build, tags) From f1355ae4b72020f540c742273a72a2cad361a815 Mon Sep 17 00:00:00 2001 From: Jacob Roberts Date: Wed, 9 Nov 2022 14:45:05 -0800 Subject: [PATCH 3/5] Update docstring comment format Co-authored-by: Brett Cannon --- tests/test_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 847b250ec..ec414f0d3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -154,8 +154,6 @@ def test_parse_sdist_filename(filename, name, version): ], ) def test_parse_sdist_invalid_filename(filename): - """ - See https://peps.python.org/pep-0625/#specification for the spec - """ + # See https://peps.python.org/pep-0625/#specification for the spec. with pytest.raises(InvalidSdistFilename): parse_sdist_filename(filename) From 584623ee11dd377259772f5e6a8b470830e44109 Mon Sep 17 00:00:00 2001 From: Jacob Roberts Date: Wed, 9 Nov 2022 14:45:12 -0800 Subject: [PATCH 4/5] Update docstring comment format Co-authored-by: Brett Cannon --- tests/test_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index ec414f0d3..cc7c915b6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -138,9 +138,7 @@ 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 - """ + # See https://peps.python.org/pep-0625/#specification for the spec. assert parse_sdist_filename(filename) == (name, version) From e6105780ad1aab51ddf0ea3d50be441510a2f655 Mon Sep 17 00:00:00 2001 From: Jacob Roberts Date: Wed, 9 Nov 2022 14:45:20 -0800 Subject: [PATCH 5/5] Update docstring comment format Co-authored-by: Brett Cannon --- tests/test_utils.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index cc7c915b6..ffac72147 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -126,9 +126,7 @@ 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 - """ + # See https://peps.python.org/pep-0427/#file-name-convention for the spec. with pytest.raises(InvalidWheelFilename): parse_wheel_filename(filename)