|
4 | 4 |
|
5 | 5 | from pip._internal.exceptions import InvalidWheelFilename
|
6 | 6 | from pip._internal.models.wheel import Wheel
|
7 |
| -from pip._internal.utils import compatibility_tags, deprecation |
| 7 | +from pip._internal.utils import compatibility_tags |
8 | 8 |
|
9 | 9 |
|
10 | 10 | class TestWheelFile:
|
11 | 11 | def test_std_wheel_pattern(self) -> None:
|
12 | 12 | w = Wheel("simple-1.1.1-py2-none-any.whl")
|
13 | 13 | assert w.name == "simple"
|
14 | 14 | assert w.version == "1.1.1"
|
15 |
| - assert w.pyversions == ["py2"] |
16 |
| - assert w.abis == ["none"] |
17 |
| - assert w.plats == ["any"] |
| 15 | + assert w.build_tag == () |
| 16 | + assert w.file_tags == frozenset( |
| 17 | + [Tag(interpreter="py2", abi="none", platform="any")] |
| 18 | + ) |
18 | 19 |
|
19 | 20 | def test_wheel_pattern_multi_values(self) -> None:
|
20 | 21 | w = Wheel("simple-1.1-py2.py3-abi1.abi2-any.whl")
|
21 | 22 | assert w.name == "simple"
|
22 | 23 | assert w.version == "1.1"
|
23 |
| - assert w.pyversions == ["py2", "py3"] |
24 |
| - assert w.abis == ["abi1", "abi2"] |
25 |
| - assert w.plats == ["any"] |
| 24 | + assert w.build_tag == () |
| 25 | + assert w.file_tags == frozenset( |
| 26 | + [ |
| 27 | + Tag(interpreter="py2", abi="abi1", platform="any"), |
| 28 | + Tag(interpreter="py2", abi="abi2", platform="any"), |
| 29 | + Tag(interpreter="py3", abi="abi1", platform="any"), |
| 30 | + Tag(interpreter="py3", abi="abi2", platform="any"), |
| 31 | + ] |
| 32 | + ) |
26 | 33 |
|
27 | 34 | def test_wheel_with_build_tag(self) -> None:
|
28 | 35 | # pip doesn't do anything with build tags, but theoretically, we might
|
29 | 36 | # see one, in this case the build tag = '4'
|
30 | 37 | w = Wheel("simple-1.1-4-py2-none-any.whl")
|
31 | 38 | assert w.name == "simple"
|
32 | 39 | assert w.version == "1.1"
|
33 |
| - assert w.pyversions == ["py2"] |
34 |
| - assert w.abis == ["none"] |
35 |
| - assert w.plats == ["any"] |
| 40 | + assert w.build_tag == (4, "") |
| 41 | + assert w.file_tags == frozenset( |
| 42 | + [Tag(interpreter="py2", abi="none", platform="any")] |
| 43 | + ) |
36 | 44 |
|
37 | 45 | def test_single_digit_version(self) -> None:
|
38 | 46 | w = Wheel("simple-1-py2-none-any.whl")
|
39 | 47 | assert w.version == "1"
|
40 | 48 |
|
41 | 49 | def test_non_pep440_version(self) -> None:
|
42 |
| - w = Wheel("simple-_invalid_-py2-none-any.whl") |
43 |
| - assert w.version == "-invalid-" |
| 50 | + with pytest.raises(InvalidWheelFilename): |
| 51 | + Wheel("simple-_invalid_-py2-none-any.whl") |
44 | 52 |
|
45 | 53 | def test_missing_version_raises(self) -> None:
|
46 | 54 | with pytest.raises(InvalidWheelFilename):
|
@@ -195,16 +203,14 @@ def test_support_index_min__none_supported(self) -> None:
|
195 | 203 |
|
196 | 204 | def test_version_underscore_conversion(self) -> None:
|
197 | 205 | """
|
198 |
| - Test that we convert '_' to '-' for versions parsed out of wheel |
199 |
| - filenames |
| 206 | + '_' is not PEP 440 compliant in the version part of a wheel filename |
200 | 207 | """
|
201 |
| - with pytest.warns(deprecation.PipDeprecationWarning): |
202 |
| - w = Wheel("simple-0.1_1-py2-none-any.whl") |
203 |
| - assert w.version == "0.1-1" |
| 208 | + with pytest.raises(InvalidWheelFilename): |
| 209 | + Wheel("simple-0.1_1-py2-none-any.whl") |
204 | 210 |
|
205 | 211 | def test_invalid_wheel_warning(self) -> None:
|
206 | 212 | """
|
207 | 213 | Test that wheel with invalid name produces warning
|
208 | 214 | """
|
209 |
| - with pytest.warns(deprecation.PipDeprecationWarning): |
| 215 | + with pytest.raises(InvalidWheelFilename): |
210 | 216 | Wheel("six-1.16.0_build1-py3-none-any.whl")
|
0 commit comments