Hi David,
On Fri, 21 Nov 2025 at 07:36, David Lechner <[email protected]> wrote:
>
> Add a check in the show_timings() function of test/py/test.py to ensure
> that the global `ubconfig` variable was actually created before trying
> use it.
>
> If tests fail early, e.g. because --build failed, ubconfig may not have
> been created yet and results in an exception in an atexit handler.
> Adding this check avoids unnecessary noise in the output.
>
> Exception ignored in atexit callback: <function cleanup at 0x7de475ea6b60>
> 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
>
> Signed-off-by: David Lechner <[email protected]>
> ---
> test/py/conftest.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/py/conftest.py b/test/py/conftest.py
> index
> 8ce680a92a0c37f36489b0782921d6cf4078850d..f889e3d3ae26db3ae19f79e236a281471d4b6de9
> 100644
> --- a/test/py/conftest.py
> +++ b/test/py/conftest.py
> @@ -613,7 +613,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" in globals() and ubconfig.timing:
> print(buf.getvalue(), end='')
Please put 'ubconfig = None' at the top of the file, then this can be:
if ubconfig.timing:
Regards,
Simon