|
6 | 6 |
|
7 | 7 | from auditwheel.architecture import Architecture
|
8 | 8 | from auditwheel.error import NonPlatformWheel
|
9 |
| -from auditwheel.wheeltools import WheelToolsError, get_wheel_architecture |
| 9 | +from auditwheel.libc import Libc |
| 10 | +from auditwheel.wheeltools import ( |
| 11 | + WheelToolsError, |
| 12 | + get_wheel_architecture, |
| 13 | + get_wheel_libc, |
| 14 | +) |
10 | 15 |
|
11 | 16 |
|
12 | 17 | @pytest.mark.parametrize(
|
@@ -41,3 +46,33 @@ def test_get_wheel_architecture_multiple(filename: str) -> None:
|
41 | 46 | match = re.escape("multiple architectures are not supported")
|
42 | 47 | with pytest.raises(WheelToolsError, match=match):
|
43 | 48 | get_wheel_architecture(filename)
|
| 49 | + |
| 50 | + |
| 51 | +@pytest.mark.parametrize( |
| 52 | + ("filename", "expected"), |
| 53 | + [ |
| 54 | + ("foo-1.0-py3-none-manylinux1_x86_64.whl", Libc.GLIBC), |
| 55 | + ("foo-1.0-py3-none-manylinux1_x86_64.manylinux2010_x86_64.whl", Libc.GLIBC), |
| 56 | + ("foo-1.0-py3-none-musllinux_1_1_x86_64.whl", Libc.MUSL), |
| 57 | + ], |
| 58 | +) |
| 59 | +def test_get_wheel_libc(filename: str, expected: Libc) -> None: |
| 60 | + libc = get_wheel_libc(filename) |
| 61 | + assert libc == expected |
| 62 | + |
| 63 | + |
| 64 | +@pytest.mark.parametrize( |
| 65 | + "filename", ["foo-1.0-py3-none-any.whl", "foo-1.0-py3-none-something.whl"] |
| 66 | +) |
| 67 | +def test_get_wheel_libc_unknown(filename: str) -> None: |
| 68 | + with pytest.raises(WheelToolsError, match=re.escape("unknown libc used")): |
| 69 | + get_wheel_libc(filename) |
| 70 | + |
| 71 | + |
| 72 | +@pytest.mark.parametrize( |
| 73 | + "filename", ["foo-1.0-py3-none-manylinux1_x86_64.musllinux_1_1_x86_64.whl"] |
| 74 | +) |
| 75 | +def test_get_wheel_libc_multiple(filename: str) -> None: |
| 76 | + match = re.escape("multiple libc are not supported") |
| 77 | + with pytest.raises(WheelToolsError, match=match): |
| 78 | + get_wheel_libc(filename) |
0 commit comments