Skip to content

Commit b892bf6

Browse files
committed
See if forcibly loading the correct libxml2 dylib before running the tests fixes the lxml test failure on CI
1 parent f951803 commit b892bf6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

setup/test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
import subprocess
77
import sys
88

9-
from setup import Command
10-
9+
from setup import Command, ismacos, is_ci
1110
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc dbcli ebooks'.split())
1211

1312

@@ -41,6 +40,13 @@ def run(self, opts):
4140
self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}')
4241
sys.stdout.flush()
4342
os.execl('setup.py', *sys.argv)
43+
if is_ci and ismacos:
44+
import ctypes
45+
sys.libxml2_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libxml2.dylib'))
46+
sys.libxslt_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libxslt.dylib'))
47+
sys.libexslt_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libexslt.dylib'))
48+
print(sys.libxml2_dylib, sys.libxslt_dylib, sys.libexslt_dylib, file=sys.stderr, flush=True)
49+
del os.environ['DYLD_LIBRARY_PATH']
4450
from calibre.utils.run_tests import (
4551
filter_tests_by_name, remove_tests_by_name, run_cli, find_tests
4652
)

setup/unix-ci.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def main():
161161
if ismacos:
162162
os.environ['SSL_CERT_FILE'] = os.path.abspath(
163163
'resources/mozilla-ca-certs.pem')
164+
os.environ['DYLD_LIBRARY_PATH'] = os.path.join(SW, 'lib')
164165

165166
install_env()
166167
run_python('setup.py test')

0 commit comments

Comments
 (0)