Skip to content

Commit

Permalink
Add integration test for --strip option
Browse files Browse the repository at this point in the history
  • Loading branch information
lkollar committed Jul 14, 2020
1 parent 02dbe02 commit c198efc
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/integration/sample_extension/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools >= 45.0.0", "cython"]
build-backend = "setuptools.build_meta"
8 changes: 8 additions & 0 deletions tests/integration/sample_extension/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from setuptools import setup
from Cython.Build import cythonize

setup(
name="sample_extension",
version="0.1.0",
ext_modules=cythonize("src/sample_extension.pyx")
)
5 changes: 5 additions & 0 deletions tests/integration/sample_extension/src/sample_extension.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def test_func(x):
return _test_func(x)

cdef _test_func(x):
return x + 1
30 changes: 30 additions & 0 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import glob
from contextlib import contextmanager
import docker
from subprocess import CalledProcessError
Expand Down Expand Up @@ -650,3 +651,32 @@ def test_build_repair_wheel_with_internal_rpath(any_manylinux_container, docker_
)
for name in w.namelist()
)


def test_strip_wheel(any_manylinux_container, docker_python, io_folder):
policy, manylinux_ctr = any_manylinux_container
docker_exec(
manylinux_ctr,
['bash', '-c', 'cd /auditwheel_src/tests/integration/sample_extension '
'&& python -m pip wheel --no-deps -w /io .']
)

orig_wheel, *_ = os.listdir(io_folder)
assert orig_wheel.startswith("sample_extension-0.1.0")

# Repair the wheel using the appropriate manylinux container
repair_command = (
'auditwheel repair --plat {policy} --strip -w /io /io/{orig_wheel}'
).format(policy=policy, orig_wheel=orig_wheel)
docker_exec(manylinux_ctr, repair_command)

repaired_wheel, *_ = glob.glob("{io_folder}/*{policy}*.whl".format(
io_folder=io_folder, policy=policy))
repaired_wheel = os.path.basename(repaired_wheel)

docker_exec(docker_python, "pip install /io/" + repaired_wheel)
output = docker_exec(
docker_python,
["python", "-c", "from sample_extension import test_func; print(test_func(1))"]
)
assert output.strip() == "2"

0 comments on commit c198efc

Please sign in to comment.