From 637942ac8e093163742d7b74bf80836c3b950c4e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 5 Jan 2026 10:49:13 -0600 Subject: [PATCH 1/3] test.py: check ubconfig exists before using it Set ubconfig to None and add a check in the show_timings() function of test/py/test.py to ensure that the global ubconfig variable was actually initialized before access attributes. If tests fail early, e.g. because --build failed, ubconfig may not have been initialized yet and results in an exception in an atexit handler. Adding this check avoids unnecessary noise in the output. Exception ignored in atexit callback: Traceback (most recent call last): File "u-boot/test/py/conftest.py", line 669, in cleanup show_timings() File "u-boot/test/py/conftest.py", line 616, in show_timings if ubconfig.timing: ^^^^^^^^ NameError: name 'ubconfig' is not defined Tested-by: Mattijs Korpershoek # sandbox Reviewed-by: Mattijs Korpershoek Signed-off-by: David Lechner --- test/py/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/py/conftest.py b/test/py/conftest.py index 8ce680a92a0..37d9347a85f 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -28,9 +28,10 @@ import sys from spawn import BootFail, Timeout, Unexpected, handle_exception import time -# Globals: The HTML log file, and the top-level fixture +# Globals: The HTML log file, the top-level fixture and the config container log = None ubman_fix = None +ubconfig = None TEST_PY_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -613,7 +614,7 @@ def show_timings(): if too_long: show_bar(f'>{get_time_delta(max_dur)}', too_long_msecs, too_long) log.info(buf.getvalue()) - if ubconfig.timing: + if ubconfig and ubconfig.timing: print(buf.getvalue(), end='') From c85d302bf2394a9c3fe95e100e014156a2e0faf5 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 5 Jan 2026 10:49:14 -0600 Subject: [PATCH 2/3] doc: pytest: mention additional requirements for venv Add a paragraph explaining that in addition to the requirements.txt for test/py/test.py itself, users may need to install additional python packages depending on the U-Boot configuration being built. Reviewed-by: Simon Glass Tested-by: Mattijs Korpershoek # sandbox Reviewed-by: Mattijs Korpershoek Signed-off-by: David Lechner --- doc/develop/pytest/usage.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/develop/pytest/usage.rst b/doc/develop/pytest/usage.rst index df3821da20d..f8b32c07edd 100644 --- a/doc/develop/pytest/usage.rst +++ b/doc/develop/pytest/usage.rst @@ -90,6 +90,10 @@ environment. This can be done via the following commands: $ . ./venv/bin/activate $ pip install -r test/py/requirements.txt +In order to use the ``--build`` option of ``test.py`` there may be additional +python packages required depending on the configuration being built. These can +be found with ``find . -name "*.requirements*.txt"``. + Testing sandbox --------------- From 487ab1c991d77b0236b30f55d7c2f89e3b948ec1 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 5 Jan 2026 10:49:15 -0600 Subject: [PATCH 3/3] pylibfdt: add requirements.txt for setuptools Add a requirements.txt file to the pylibfdt script directory to specify setuptools as a dependency. This follows the pattern of each tool in U-Boot having its own requirements.txt file. The version is set to 78.1.1 to avoid conflict with the same in tools/patman/requirements.txt. Reviewed-by: Simon Glass Tested-by: Mattijs Korpershoek # sandbox Reviewed-by: Mattijs Korpershoek Signed-off-by: David Lechner --- scripts/dtc/pylibfdt/requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/dtc/pylibfdt/requirements.txt diff --git a/scripts/dtc/pylibfdt/requirements.txt b/scripts/dtc/pylibfdt/requirements.txt new file mode 100644 index 00000000000..b7dbecdd587 --- /dev/null +++ b/scripts/dtc/pylibfdt/requirements.txt @@ -0,0 +1 @@ +setuptools==78.1.1