Skip to content

Commit

Permalink
Test musllinux integration into packaging.tags
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Apr 7, 2021
1 parent 20576fb commit 498aef1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ctypes = None
import distutils.util
import os
import pathlib
import platform
import sys
import sysconfig
Expand Down Expand Up @@ -593,6 +594,44 @@ def test_linux_platforms_manylinux_glibc3(self, monkeypatch):
)
assert platforms == expected

@pytest.mark.parametrize(
"native_arch, cross32_arch, musl_version",
[
("aarch64", "armv7l", (1, 1)),
("i386", "i386", (1, 2)),
("x86_64", "i686", (1, 2)),
],
)
@pytest.mark.parametrize("cross32", [True, False], ids=["cross", "native"])
def test_linux_platforms_musllinux(
self,
monkeypatch,
native_arch,
cross32_arch,
musl_version,
cross32,
):
fake_executable = str(
pathlib.Path(__file__)
.parent
.joinpath("musllinux", f"musl-{native_arch}")
.resolve()
)
monkeypatch.setattr(tags._musllinux.sys, "executable", fake_executable)
monkeypatch.setattr(
distutils.util,
"get_platform",
lambda: f"linux_{native_arch}",
)

platforms = list(tags._linux_platforms(is_32bit=cross32))
target_arch = cross32_arch if cross32 else native_arch
expected = [
f"musllinux_{musl_version[0]}_{minor}_{target_arch}"
for minor in range(musl_version[1], -1, -1)
] + [f"linux_{target_arch}"]
assert platforms == expected

def test_linux_platforms_manylinux2014_armv6l(self, monkeypatch):
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux2014"
Expand Down

0 comments on commit 498aef1

Please sign in to comment.