Skip to content

Commit 254e4f2

Browse files
committed
Fix existing tests from deprecated to raises
1 parent 61cbca0 commit 254e4f2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/unit/test_models_wheel.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pip._internal.exceptions import InvalidWheelFilename
66
from pip._internal.models.wheel import Wheel
7-
from pip._internal.utils import compatibility_tags, deprecation
7+
from pip._internal.utils import compatibility_tags
88

99

1010
class TestWheelFile:
@@ -47,9 +47,8 @@ def test_single_digit_version(self) -> None:
4747
assert w.version == "1"
4848

4949
def test_non_pep440_version(self) -> None:
50-
with pytest.warns(deprecation.PipDeprecationWarning):
51-
w = Wheel("simple-_invalid_-py2-none-any.whl")
52-
assert w.version == "-invalid-"
50+
with pytest.raises(InvalidWheelFilename):
51+
Wheel("simple-_invalid_-py2-none-any.whl")
5352

5453
def test_missing_version_raises(self) -> None:
5554
with pytest.raises(InvalidWheelFilename):
@@ -254,16 +253,14 @@ def test_support_index_min__none_supported(self) -> None:
254253

255254
def test_version_underscore_conversion(self) -> None:
256255
"""
257-
Test that we convert '_' to '-' for versions parsed out of wheel
258-
filenames
256+
Test that underscore versions are now invalid (no longer converted)
259257
"""
260-
with pytest.warns(deprecation.PipDeprecationWarning):
261-
w = Wheel("simple-0.1_1-py2-none-any.whl")
262-
assert w.version == "0.1-1"
258+
with pytest.raises(InvalidWheelFilename):
259+
Wheel("simple-0.1_1-py2-none-any.whl")
263260

264-
def test_invalid_wheel_warning(self) -> None:
261+
def test_invalid_wheel_raises(self) -> None:
265262
"""
266-
Test that wheel with invalid name produces warning
263+
Test that wheel with invalid name now raises exception
267264
"""
268-
with pytest.warns(deprecation.PipDeprecationWarning):
265+
with pytest.raises(InvalidWheelFilename):
269266
Wheel("six-1.16.0_build1-py3-none-any.whl")

0 commit comments

Comments
 (0)