binman: Add a test function to clean up the output dir
authorSimon Glass <sjg@chromium.org>
Sat, 20 Jul 2019 18:24:09 +0000 (12:24 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 29 Jul 2019 15:38:06 +0000 (09:38 -0600)
Put tearDown()'s logic into a new _CleanupOutputDir() function so that it
can be called from elsewhere.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/binman/ftest.py

index 04bd9f886c5fa2dbb532ec13ecf7cb42dd10f0e8..a51865c5c7ec57955ea609faf89a834e265ac1fa 100644 (file)
@@ -187,6 +187,13 @@ class TestFunctional(unittest.TestCase):
         if not self.have_lz4:
             self.skipTest('lz4 --no-frame-crc not available')
 
+    def _CleanupOutputDir(self):
+        """Remove the temporary output directory"""
+        if self.preserve_outdirs:
+            print('Preserving output dir: %s' % tools.outdir)
+        else:
+            tools._FinaliseForTest()
+
     def setUp(self):
         # Enable this to turn on debugging output
         # tout.Init(tout.DEBUG)
@@ -194,10 +201,7 @@ class TestFunctional(unittest.TestCase):
 
     def tearDown(self):
         """Remove the temporary output directory"""
-        if self.preserve_outdirs:
-            print('Preserving output dir: %s' % tools.outdir)
-        else:
-            tools._FinaliseForTest()
+        self._CleanupOutputDir()
 
     @classmethod
     def _ResetDtbs(self):