[tracker/functional-tests-applications: 7/14] functional tests, applications: Setup and teardown each test independently



commit 8ad0664a517cded76f91b3e28b6c94addf818663
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Thu Jan 20 20:34:07 2011 +0100

    functional tests, applications: Setup and teardown each test independently

 .../common/utils/applicationstest.py               |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/applicationstest.py b/tests/functional-tests/common/utils/applicationstest.py
index 19b2330..de78af7 100644
--- a/tests/functional-tests/common/utils/applicationstest.py
+++ b/tests/functional-tests/common/utils/applicationstest.py
@@ -35,13 +35,11 @@ def uri (filename):
     return "file://" + os.path.join (APPLICATIONS_TMP_DIR, filename)
 
 # Being rate defined in amount of BYTES per 100ms
-def slowcopy (src, dest, rate):
+def slowcopy_fd (src, dest, fdest, rate):
+    print "Copying from '%s' to '%s' at a rate of %u bytes/100ms" % (src, dest, rate)
     fsrc = open (src, 'rb')
-    fdest = open (dest, 'wb')
-
     buffer = fsrc.read (rate)
     while (buffer != ""):
-        print "Slow write..."
         fdest.write (buffer)
         time.sleep (0.1)
         buffer = fsrc.read (rate)
@@ -49,11 +47,15 @@ def slowcopy (src, dest, rate):
     fsrc.close ()
     fdest.close ()
 
+def slowcopy (src, dest, rate):
+    fdest = open (dest, 'wb')
+    slowcopy_fd (src, dest, fdest, rate)
+
 
 class CommonTrackerApplicationTest (ut.TestCase):
 
     @classmethod
-    def setUpClass (self):
+    def setUp (self):
         # Create temp directory to monitor
         if (os.path.exists (APPLICATIONS_TMP_DIR)):
             shutil.rmtree (APPLICATIONS_TMP_DIR)
@@ -88,7 +90,7 @@ class CommonTrackerApplicationTest (ut.TestCase):
         print "    Using temp dir at '%s'..." % (APPLICATIONS_TMP_DIR)
 
     @classmethod
-    def tearDownClass (self):
+    def tearDown (self):
         #print "Stopping the daemon in test mode (Doing nothing now)"
         self.system.tracker_all_testing_stop ()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]