[bitbake-devel] [PATCH 08/11] toaster: tts: delete the database only if created

Ed Bartosh ed.bartosh at linux.intel.com
Thu Jul 30 16:25:16 UTC 2015


From: Alexandru DAMIAN <alexandru.damian at intel.com>

To allow the tests to run on different databases (in case of
manual runs), the HTML5 test will only delete the database
file if it was created in the setUp.

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 lib/toaster/contrib/tts/tests.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/toaster/contrib/tts/tests.py b/lib/toaster/contrib/tts/tests.py
index fd6aa3b..8d19647 100644
--- a/lib/toaster/contrib/tts/tests.py
+++ b/lib/toaster/contrib/tts/tests.py
@@ -59,8 +59,10 @@ class TestHTML5Compliance(unittest.TestCase):
     def setUp(self):
         self.origdir = os.getcwd()
         self.crtdir = os.path.dirname(config.TESTDIR)
+        self.cleanup_database = False
         os.chdir(self.crtdir)
         if not os.path.exists(os.path.join(self.crtdir, "toaster.sqlite")):
+            self.cleanup_database = False
             run_shell_cmd("%s/bitbake/lib/toaster/manage.py syncdb --noinput" % config.TESTDIR)
             run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate orm" % config.TESTDIR)
             run_shell_cmd("%s/bitbake/lib/toaster/manage.py migrate bldcontrol" % config.TESTDIR)
@@ -102,5 +104,5 @@ class TestHTML5Compliance(unittest.TestCase):
             time.sleep(1)
         os.chdir(self.origdir)
         toaster_sqlite_path = os.path.join(self.crtdir, "toaster.sqlite")
-        if os.path.exists(toaster_sqlite_path):
+        if self.cleanup_database and os.path.exists(toaster_sqlite_path):
             os.remove(toaster_sqlite_path)
-- 
2.1.4




More information about the bitbake-devel mailing list