Re: [U-Boot] [PATCHv2 07/13] test/py: test_ut.py: Ensure we use bytes

2019-10-23 Thread Simon Glass
On Tue, 22 Oct 2019 at 21:20, Tom Rini  wrote:
>
> In the case of some unit tests we are working with providing a fake
> flash device that we have written some text strings in to.  In this case
> we want to tell Python to encode things to bytes for us.
>
> Reviewed-by: Stephen Warren 
> Signed-off-by: Tom Rini 
> ---
>  test/py/tests/test_ut.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 
Tested on sandbox:
Tested-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCHv2 07/13] test/py: test_ut.py: Ensure we use bytes

2019-10-22 Thread Tom Rini
In the case of some unit tests we are working with providing a fake
flash device that we have written some text strings in to.  In this case
we want to tell Python to encode things to bytes for us.

Reviewed-by: Stephen Warren 
Signed-off-by: Tom Rini 
---
 test/py/tests/test_ut.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/py/tests/test_ut.py b/test/py/tests/test_ut.py
index 62037d2c4530..6c7b8dd2b30e 100644
--- a/test/py/tests/test_ut.py
+++ b/test/py/tests/test_ut.py
@@ -10,14 +10,14 @@ def test_ut_dm_init(u_boot_console):
 
 fn = u_boot_console.config.source_dir + '/testflash.bin'
 if not os.path.exists(fn):
-data = 'this is a test'
-data += '\x00' * ((4 * 1024 * 1024) - len(data))
+data = b'this is a test'
+data += b'\x00' * ((4 * 1024 * 1024) - len(data))
 with open(fn, 'wb') as fh:
 fh.write(data)
 
 fn = u_boot_console.config.source_dir + '/spi.bin'
 if not os.path.exists(fn):
-data = '\x00' * (2 * 1024 * 1024)
+data = b'\x00' * (2 * 1024 * 1024)
 with open(fn, 'wb') as fh:
 fh.write(data)
 
-- 
2.17.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot