]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: fix TestFdtUtil()
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 20 Apr 2023 18:03:43 +0000 (20:03 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 3 May 2023 22:30:46 +0000 (18:30 -0400)
Variable old_outdir cannot be used before assignment.
The assignment must occur before the try block.

tools/dtoc/test_fdt.py:796:26:
E0601: Using variable 'old_outdir' before assignment
(used-before-assignment)

Add missing space in assignment.

Fixes: a004f29464d1 ("binman: Tidy up _SetupDtb() to use its own temporary file")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
tools/dtoc/test_fdt.py

index 32fa69cbb01855ea8d1144676956b3f94ea7200c..4fe8d12c403a07acec5fc971b08c1ef7258e93ca 100755 (executable)
@@ -784,8 +784,8 @@ class TestFdtUtil(unittest.TestCase):
 
     def test_ensure_compiled_tmpdir(self):
         """Test providing a temporary directory"""
+        old_outdir = tools.outdir
         try:
-            old_outdir = tools.outdir
             tools.outdir= None
             tmpdir = tempfile.mkdtemp(prefix='test_fdt.')
             dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_simple.dts'),
@@ -793,7 +793,7 @@ class TestFdtUtil(unittest.TestCase):
             self.assertEqual(tmpdir, os.path.dirname(dtb))
             shutil.rmtree(tmpdir)
         finally:
-            tools.outdir= old_outdir
+            tools.outdir = old_outdir
 
     def test_get_phandle_name_offset(self):
         val = fdt_util.GetPhandleNameOffset(self.node, 'missing')