On 2026-05-31T15:24:23, Francesco Valla <[email protected]> wrote:
> dtoc: test: add missing escape in help text
>
> A single percent sign might be interpreted as a string format directive
> and shall thus be escaped - doubling it - to actually indicate a
> percentage.
>
> Without the escape, pytest fails to run test_fdt.py with the following
> error:
>
>   ValueError: Test coverage failure
>   fdt code coverage: Traceback (most recent call last):
>     File '/usr/lib64/python3.14/argparse.py', line 1748, in _check_help
>       formatter._expand_help(action)
>       ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
>     File '/usr/lib64/python3.14/argparse.py', line 676, in _expand_help
>       return help_string % params
>              ~~~~~~~~~~~~^~~~~~~~
>   TypeError: %c requires an int or a unicode character, not dict
>
>   The above exception was the direct cause of the following exception:
>
>   Traceback (most recent call last):
>     File '/home/user/u-boot/./tools/dtoc/test_fdt', line 1002, in <module>
>       sys.exit(main())
>                ~~~~^^
>     File '/home/user/u-boot/./tools/dtoc/test_fdt', line 987, in main
>       parser.add_argument('-T', '--test-coverage', action='store_true',
>       ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                           default=False,
>                           ^^^^^^^^^^^^^^
>                           help='run tests and check for 100% coverage')
>                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>     File '/usr/lib64/python3.14/argparse.py', line 1562, in add_argument
>       self._check_help(action)
>       ~~~~~~~~~~~~~~~~^^^^^^^^
>     File '/usr/lib64/python3.14/argparse.py', line 1750, in _check_help
>       raise ValueError('badly formed help string') from exc
>   ValueError: badly formed help string
>
> Fixes: 7640b166604e ("test_fdt: Convert to use argparse")
> Signed-off-by: Francesco Valla <[email protected]>
>
> tools/dtoc/test_fdt.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to