Skip to content

Commit 9d45f13

Browse files
committed
TST: Use different library file for link test
The old test seemed to pick up the 32-bit library, not the 64-bit one. The new test should pick up the 64-bit one consistently when relevant.
1 parent 19ea50b commit 9d45f13

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

distutils/tests/test_build_ext.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import re
77
import shutil
88
import site
9+
import subprocess
910
import sys
1011
import tempfile
1112
import textwrap
@@ -112,8 +113,8 @@ def test_build_ext(self, copy_so):
112113
)
113114
elif sys.platform == 'linux':
114115
libz_so = glob.glob('/usr/lib*/libz.so*')
115-
shutil.copyfile(libz_so[0], '/tmp/libxx_z.so')
116-
116+
shutil.copyfile(libz_so[-1], '/tmp/libxx_z.so')
117+
117118
xx_ext = Extension(
118119
'xx',
119120
[xx_c],
@@ -140,7 +141,7 @@ def test_build_ext(self, copy_so):
140141

141142
with safe_extension_import('xx', self.tmp_dir):
142143
self._test_xx(copy_so)
143-
144+
144145
if sys.platform == 'linux' and copy_so:
145146
os.unlink('/tmp/libxx_z.so')
146147

@@ -159,9 +160,11 @@ def _test_xx(copy_so):
159160
assert xx.__doc__ == doc
160161
assert isinstance(xx.Null(), xx.Null)
161162
assert isinstance(xx.Str(), xx.Str)
162-
163+
163164
if sys.platform == 'linux':
164-
so_headers = subprocess.check_output(["readelf", "-d", xx.__file__], universal_newlines=True)
165+
so_headers = subprocess.check_output(
166+
["readelf", "-d", xx.__file__], universal_newlines=True
167+
)
165168
if not copy_so:
166169
# Linked against a library in /usr/lib{,64}
167170
assert 'RPATH' not in so_headers and 'RUNPATH' not in so_headers

0 commit comments

Comments
 (0)