[tracker/sam/functional-test-runner: 11/15] there it is



commit 28c537abc665e294b77a25904d18ec646237d7a0
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Dec 30 00:49:03 2014 +0000

    there it is

 .../functional-tests/store/test_backup_restore.py  |   16 ++++----
 tests/functional-tests/store/test_transactions.py  |   44 ++++++++++---------
 tests/functional-tests/store/testcase.py           |    1 +
 3 files changed, 32 insertions(+), 29 deletions(-)
---
diff --git a/tests/functional-tests/store/test_backup_restore.py 
b/tests/functional-tests/store/test_backup_restore.py
index 6a040f3..a232021 100644
--- a/tests/functional-tests/store/test_backup_restore.py
+++ b/tests/functional-tests/store/test_backup_restore.py
@@ -124,8 +124,8 @@ class BackupRestoreTest (testcase.TrackerStoreTest):
         trashfile.close()
 
         self.assertRaises(dbus.DBusException,
-                            self.tracker.restore,
-                            "file://" + TEST_FILE)
+                          self.tracker.restore,
+                          "file://" + TEST_FILE)
         os.unlink(TEST_FILE)
 
     def test_backup_04(self):
@@ -144,8 +144,8 @@ class BackupRestoreTest (testcase.TrackerStoreTest):
         instances_before = self.tracker.count_instances(
             "nie:InformationElement")
         self.assertRaises(dbus.DBusException,
-                            self.tracker.restore,
-                            "file://" + TEST_FILE)
+                          self.tracker.restore,
+                          "file://" + TEST_FILE)
 
         os.unlink(TEST_FILE)
 
@@ -155,16 +155,16 @@ class BackupRestoreTest (testcase.TrackerStoreTest):
         Expected: Backup should not be taken and tracker should behave normally.
         """
         self.assertRaises(dbus.DBusException,
-                            self.tracker.backup,
-                            "file://%s/this/is/a/non-existant/folder/backup" % (cfg.TEST_TMP_DIR))
+                          self.tracker.backup,
+                          "file://%s/this/is/a/non-existant/folder/backup" % (cfg.TEST_TMP_DIR))
 
     def test_backup_06(self):
         """
         Try to restore an invalid path
         """
         self.assertRaises(dbus.DBusException,
-                            self.tracker.restore,
-                            "file://%s/this/is/a/non-existant/folder/backup" % (cfg.TEST_TMP_DIR))
+                          self.tracker.restore,
+                          "file://%s/this/is/a/non-existant/folder/backup" % (cfg.TEST_TMP_DIR))
 
     def test_backup_07(self):
         """
diff --git a/tests/functional-tests/store/test_transactions.py 
b/tests/functional-tests/store/test_transactions.py
index 5f6a53c..72d0952 100644
--- a/tests/functional-tests/store/test_transactions.py
+++ b/tests/functional-tests/store/test_transactions.py
@@ -31,7 +31,9 @@ import testcase
 
 TEST_INSTANCE_PATTERN = "test://12-transactions-%d"
 
+
 class TrackerTransactionsTest(testcase.TrackerSToreTest):
+
     """
     In a loop:
        1. Inserts a Batch of instances
@@ -42,50 +44,50 @@ class TrackerTransactionsTest(testcase.TrackerSToreTest):
     If the commit was real, all the inserted instances should be there.
     """
 
-    def setUp (self):
+    def setUp(self):
         super(TrackerTransactionsTest, self).setUp()
 
         self.instance_counter = 0
 
-    def tearDown (self):
+    def tearDown(self):
         print "Tear down (will take some time to remove all resources)"
         delete_sparql = "DELETE { ?u a rdfs:Resource } WHERE { ?u a nmo:Email} \n"
-        self.tracker.update (delete_sparql,
-                             timeout=60000)
+        self.tracker.update(delete_sparql,
+                            timeout=60000)
         self.instance_counter = 0
 
         super(TrackerTransactionsTest, self).tearDown()
 
-    def insert_and_commit (self, number):
+    def insert_and_commit(self, number):
         insert_sparql = "INSERT {\n"
-        for i in range (0, number):
-            insert_sparql += "  <" + TEST_INSTANCE_PATTERN % (self.instance_counter) + ">"
+        for i in range(0, number):
+            insert_sparql += "  <" + \
+                TEST_INSTANCE_PATTERN % (self.instance_counter) + ">"
             insert_sparql += " a nmo:Email.\n "
             self.instance_counter += 1
 
         insert_sparql += "}"
-        self.tracker.batch_update (insert_sparql)
-        #print "Waiting for commit (", number," instances)"
+        self.tracker.batch_update(insert_sparql)
+        # print "Waiting for commit (", number," instances)"
         #start = time.time ()
-        self.tracker.batch_commit ()
+        self.tracker.batch_commit()
         #end = time.time ()
-        #print "BatchCommit returned (after %d s.)" % (end - start)
-
+        # print "BatchCommit returned (after %d s.)" % (end - start)
 
-    def test_commit_and_abort (self):
+    def test_commit_and_abort(self):
 
-        for i in range (0, 20):
+        for i in range(0, 20):
             NUMBER_OF_INSTANCES = 1000
-            self.insert_and_commit (NUMBER_OF_INSTANCES)
+            self.insert_and_commit(NUMBER_OF_INSTANCES)
 
-            self.system.tracker_store_stop_brutally ()
-            self.system.tracker_store_start ()
+            self.system.tracker_store_stop_brutally()
+            self.system.tracker_store_start()
             try:
-                results = self.tracker.count_instances ("nmo:Email")
+                results = self.tracker.count_instances("nmo:Email")
             except:
                 print "Timeout, probably replaying journal or something (wait 20 sec.)"
-                time.sleep (20)
-                results = self.tracker.count_instances ()
+                time.sleep(20)
+                results = self.tracker.count_instances()
 
             # Every iteration we are adding new instances in the store!
-            self.assertEquals (results, NUMBER_OF_INSTANCES * (i+1))
+            self.assertEquals(results, NUMBER_OF_INSTANCES * (i + 1))
diff --git a/tests/functional-tests/store/testcase.py b/tests/functional-tests/store/testcase.py
index 4403d7a..395f685 100644
--- a/tests/functional-tests/store/testcase.py
+++ b/tests/functional-tests/store/testcase.py
@@ -23,6 +23,7 @@ import common
 
 
 class TrackerStoreTest(unittest.TestCase):
+
     '''Common superclass for tests that just require a fresh store running.
 
     The tracker-store test suites run each test case in one instance of


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