Skip to content

Commit f45e89d

Browse files
committed
Workaround manylinux-interpreters ensure graalpy* warning in pip
1 parent 5fe2161 commit f45e89d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/test_0_basic.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import textwrap
23

34
import pytest
@@ -41,7 +42,22 @@ def test(tmp_path, build_frontend_env, capfd):
4142
# Verify pip warning not shown
4243
captured = capfd.readouterr()
4344
for stream in (captured.err, captured.out):
44-
assert "WARNING: Running pip as the 'root' user can result" not in stream
45+
# manylinux-interpreters ensure will run pip on GraalPy as the root
46+
# user once, so we will get the warning below. We make sure it is only
47+
# because of manylinux and nothing else. We do this by checking that
48+
# the error message only occurs directly after a call to graalpy's
49+
# ensurepip in the manylinux `/opt/` directory
50+
start = 0
51+
bad_msg = "WARNING: Running pip as the 'root' user can result"
52+
assert_msg = f"{bad_msg} is only tolerated from manylinux's ensure for graalpy"
53+
for m in re.finditer(bad_msg, stream):
54+
idx = stream.rfind("/opt/", start, m.end())
55+
start = m.end()
56+
m2 = re.match(
57+
"/opt/.*/graalpy.*/bin/python -m ensurepip --default-pip", stream[idx : m.start()]
58+
)
59+
assert m2 is not None, assert_msg
60+
assert idx + m2.end() + 1 == m.start(), assert_msg
4561
assert "A new release of pip available" not in stream
4662

4763

0 commit comments

Comments
 (0)