Skip to content

Commit c198efc

Browse files
committed
Add integration test for --strip option
1 parent 02dbe02 commit c198efc

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools >= 45.0.0", "cython"]
3+
build-backend = "setuptools.build_meta"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from setuptools import setup
2+
from Cython.Build import cythonize
3+
4+
setup(
5+
name="sample_extension",
6+
version="0.1.0",
7+
ext_modules=cythonize("src/sample_extension.pyx")
8+
)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def test_func(x):
2+
return _test_func(x)
3+
4+
cdef _test_func(x):
5+
return x + 1

tests/integration/test_manylinux.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import glob
12
from contextlib import contextmanager
23
import docker
34
from subprocess import CalledProcessError
@@ -650,3 +651,32 @@ def test_build_repair_wheel_with_internal_rpath(any_manylinux_container, docker_
650651
)
651652
for name in w.namelist()
652653
)
654+
655+
656+
def test_strip_wheel(any_manylinux_container, docker_python, io_folder):
657+
policy, manylinux_ctr = any_manylinux_container
658+
docker_exec(
659+
manylinux_ctr,
660+
['bash', '-c', 'cd /auditwheel_src/tests/integration/sample_extension '
661+
'&& python -m pip wheel --no-deps -w /io .']
662+
)
663+
664+
orig_wheel, *_ = os.listdir(io_folder)
665+
assert orig_wheel.startswith("sample_extension-0.1.0")
666+
667+
# Repair the wheel using the appropriate manylinux container
668+
repair_command = (
669+
'auditwheel repair --plat {policy} --strip -w /io /io/{orig_wheel}'
670+
).format(policy=policy, orig_wheel=orig_wheel)
671+
docker_exec(manylinux_ctr, repair_command)
672+
673+
repaired_wheel, *_ = glob.glob("{io_folder}/*{policy}*.whl".format(
674+
io_folder=io_folder, policy=policy))
675+
repaired_wheel = os.path.basename(repaired_wheel)
676+
677+
docker_exec(docker_python, "pip install /io/" + repaired_wheel)
678+
output = docker_exec(
679+
docker_python,
680+
["python", "-c", "from sample_extension import test_func; print(test_func(1))"]
681+
)
682+
assert output.strip() == "2"

0 commit comments

Comments
 (0)