example_test.py: In ota example_test, open file in binary mode to avoid UnicodeDecodeError

This commit is contained in:
Shubham Kulkarni 2020-10-07 18:15:19 +05:30 committed by bot
parent eb83878323
commit 76860cc939
2 changed files with 8 additions and 8 deletions

View File

@ -234,8 +234,8 @@ def test_examples_protocol_advanced_https_ota_example_truncated_bin(env, extra_d
truncated_bin_size = 64000
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, bin_name)
f = open(binary_file, "r+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "w+")
f = open(binary_file, "rb+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "wb+")
fo.write(f.read(truncated_bin_size))
fo.close()
f.close()
@ -285,8 +285,8 @@ def test_examples_protocol_advanced_https_ota_example_truncated_header(env, extr
truncated_bin_size = 180
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, bin_name)
f = open(binary_file, "r+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "w+")
f = open(binary_file, "rb+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "wb+")
fo.write(f.read(truncated_bin_size))
fo.close()
f.close()

View File

@ -201,8 +201,8 @@ def test_examples_protocol_native_ota_example_truncated_bin(env, extra_data):
truncated_bin_size = 64000
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, bin_name)
f = open(binary_file, "r+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "w+")
f = open(binary_file, "rb+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "wb+")
fo.write(f.read(truncated_bin_size))
fo.close()
f.close()
@ -252,8 +252,8 @@ def test_examples_protocol_native_ota_example_truncated_header(env, extra_data):
truncated_bin_size = 180
# check and log bin size
binary_file = os.path.join(dut1.app.binary_path, bin_name)
f = open(binary_file, "r+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "w+")
f = open(binary_file, "rb+")
fo = open(os.path.join(dut1.app.binary_path, truncated_bin_name), "wb+")
fo.write(f.read(truncated_bin_size))
fo.close()
f.close()