support/testing: test_python.py: disable interpreter colors

Python 3.14 (not yet in Buildroot) introduced colors, enabled by
default, when the output is a terminal. This behavior can make the
pexpect pattern matching more difficult in some cases. See:
https://docs.python.org/3.14/using/cmdline.html#controlling-color

This commit globally disables the Python interpreter colors in the base
runtime Python test, by setting the NO_COLOR=1 environment variable.

Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit 3a6e2b4a03)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Julien Olivain
2026-01-18 16:22:50 +01:00
committed by Thomas Perale
parent 15865764ab
commit 52ff864c58

View File

@@ -17,6 +17,9 @@ class TestPythonBase(infra.basetest.BRTest):
kernel="builtin",
options=["-initrd", cpio_file])
self.emulator.login()
# Disable Python colors for all Python tests, to make pexpect
# pattern matching easier.
self.assertRunOk("export NO_COLOR=1")
def version_test(self, version, timeout=-1):
cmd = self.interpreter + " --version 2>&1 | grep '^{}'".format(version)