mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 07:04:28 +00:00
binman: used-before-assignment in ftest.py
Pytest 7.4.3 complains if a variable is used in a finally clause without having been initialized before the try clause. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
86aeacca67
commit
69c3705be9
1 changed files with 15 additions and 5 deletions
|
@ -2842,11 +2842,13 @@ class TestFunctional(unittest.TestCase):
|
|||
fdt_size = entries['section'].GetEntries()['u-boot-dtb'].size
|
||||
fdtmap_offset = entries['fdtmap'].offset
|
||||
|
||||
tmpdir = None
|
||||
try:
|
||||
tmpdir, updated_fname = self._SetupImageInTmpdir()
|
||||
with test_util.capture_sys_output() as (stdout, stderr):
|
||||
self._DoBinman('ls', '-i', updated_fname)
|
||||
finally:
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
lines = stdout.getvalue().splitlines()
|
||||
expected = [
|
||||
|
@ -2868,11 +2870,13 @@ class TestFunctional(unittest.TestCase):
|
|||
def testListCmdFail(self):
|
||||
"""Test failing to list an image"""
|
||||
self._DoReadFile('005_simple.dts')
|
||||
tmpdir = None
|
||||
try:
|
||||
tmpdir, updated_fname = self._SetupImageInTmpdir()
|
||||
with self.assertRaises(ValueError) as e:
|
||||
self._DoBinman('ls', '-i', updated_fname)
|
||||
finally:
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
self.assertIn("Cannot find FDT map in image", str(e.exception))
|
||||
|
||||
|
@ -3002,12 +3006,14 @@ class TestFunctional(unittest.TestCase):
|
|||
self._CheckLz4()
|
||||
self._DoReadFileRealDtb('130_list_fdtmap.dts')
|
||||
fname = os.path.join(self._indir, 'output.extact')
|
||||
tmpdir = None
|
||||
try:
|
||||
tmpdir, updated_fname = self._SetupImageInTmpdir()
|
||||
with test_util.capture_sys_output() as (stdout, stderr):
|
||||
self._DoBinman('extract', '-i', updated_fname, 'u-boot',
|
||||
'-f', fname)
|
||||
finally:
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
data = tools.read_file(fname)
|
||||
self.assertEqual(U_BOOT_DATA, data)
|
||||
|
@ -5185,11 +5191,13 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
|||
data = self._DoReadFileRealDtb('207_fip_ls.dts')
|
||||
hdr, fents = fip_util.decode_fip(data)
|
||||
|
||||
tmpdir = None
|
||||
try:
|
||||
tmpdir, updated_fname = self._SetupImageInTmpdir()
|
||||
with test_util.capture_sys_output() as (stdout, stderr):
|
||||
self._DoBinman('ls', '-i', updated_fname)
|
||||
finally:
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
lines = stdout.getvalue().splitlines()
|
||||
expected = [
|
||||
|
@ -5395,11 +5403,13 @@ fdt fdtmap Extract the devicetree blob from the fdtmap
|
|||
use_real_dtb=True,
|
||||
extra_indirs=[os.path.join(self._indir, TEST_FDT_SUBDIR)])
|
||||
|
||||
tmpdir = None
|
||||
try:
|
||||
tmpdir, updated_fname = self._SetupImageInTmpdir()
|
||||
with test_util.capture_sys_output() as (stdout, stderr):
|
||||
self._RunBinman('ls', '-i', updated_fname)
|
||||
finally:
|
||||
if tmpdir:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
def testFitSubentryUsesBintool(self):
|
||||
|
|
Loading…
Reference in a new issue