mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
oeqa/sdk/maturin: be less picky in the list_python test
The test assumed that maturin would only find a single Python binary, in /usr/bin/python3*. However in eSDKs with buildtools a Python is shipped with the SDK, so the test failed. Generalise the test so that it runs python3 and obtains its path and version, and then verifies that path and and version are found by Maturin. This means we're not assuming a single Python, or the paths, or that the Python is CPython. (From OE-Core rev: ae9b5dae77ef140422fcf71d239ca028c9208447) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
b8009efc19
commit
04e4586c66
|
@ -19,17 +19,15 @@ class MaturinTest(OESDKTestCase):
|
||||||
self.ensure_host_package("python3-maturin")
|
self.ensure_host_package("python3-maturin")
|
||||||
|
|
||||||
def test_maturin_list_python(self):
|
def test_maturin_list_python(self):
|
||||||
py_major = self._run("python3 -c 'import sys; print(sys.version_info.major)'")
|
out = self._run(r"""python3 -c 'import sys; print(f"{sys.executable}\n{sys.version_info.major}.{sys.version_info.minor}")'""")
|
||||||
py_minor = self._run("python3 -c 'import sys; print(sys.version_info.minor)'")
|
executable, version = out.splitlines()
|
||||||
python_version = "%s.%s" % (py_major.strip(), py_minor.strip())
|
|
||||||
cmd = "maturin list-python"
|
|
||||||
output = self._run(cmd)
|
|
||||||
self.assertRegex(output, r"^🐍 1 python interpreter found:\n")
|
|
||||||
self.assertRegex(
|
|
||||||
output,
|
|
||||||
r" - CPython %s (.+)/usr/bin/python%s$" % (python_version, python_version),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
output = self._run("maturin list-python")
|
||||||
|
# The output looks like this:
|
||||||
|
# - CPython 3.13 at /usr/bin/python3
|
||||||
|
# We don't want to assume CPython so just check for the version and path.
|
||||||
|
expected = f"{version} at {executable}"
|
||||||
|
self.assertIn(expected, output)
|
||||||
|
|
||||||
class MaturinDevelopTest(OESDKTestCase):
|
class MaturinDevelopTest(OESDKTestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue
Block a user