Skip to content

Commit 9247319

Browse files
committed
Simulate the case PyCall is configured with statically linked Python
1 parent b26844a commit 9247319

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

test/test_compatible_exe.py

+35-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def _get_paths(path):
19-
return filter(None, path.split(":"))
19+
return list(filter(None, path.split(":")))
2020

2121

2222
# Environment variable PYJULIA_TEST_INCOMPATIBLE_PYTHONS is the
@@ -134,3 +134,37 @@ def test_incompatible_python(python):
134134
assert "`libpython` have to match" in proc.stderr
135135
elif dynamic is False:
136136
assert "is statically linked to libpython" in proc.stderr
137+
138+
139+
@pytest.mark.parametrize(
140+
"python",
141+
[
142+
p
143+
for p in filter(None, map(which, incompatible_pythons))
144+
if is_dynamically_linked(p) is False
145+
],
146+
)
147+
def test_statically_linked(python):
148+
"""
149+
Simulate the case PyCall is configured with statically linked Python.
150+
151+
In this case, `find_libpython()` would return the path identical
152+
to the one in PyCall's deps.jl. `is_compatible_exe` should reject
153+
it.
154+
"""
155+
python = which(python)
156+
proc = runcode(
157+
python,
158+
"""
159+
from __future__ import print_function
160+
from julia.find_libpython import find_libpython
161+
from julia.core import is_compatible_exe
162+
163+
class jlinfo:
164+
libpython = find_libpython()
165+
166+
assert not is_compatible_exe(jlinfo, _debug=print)
167+
""",
168+
)
169+
print_completed_proc(proc)
170+
assert proc.returncode == 0

0 commit comments

Comments
 (0)