[tracker/sam/functional-test-runner: 8/15] WIP: functional-tests: Use Python 'unittest' test runner



commit af0ad7ba5814838a96014e439c52c43e6d943794
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Dec 28 22:23:04 2014 +0000

    WIP: functional-tests: Use Python 'unittest' test runner
    
    The store tests seem to fail because the store hasn't fully loaded by
    the time the test starts. It might be worth not isolating the store
    tests, since they work fine anyway most of the time ...
    
    Some other weird error occurs too.

 tests/functional-tests/common/__init__.py          |   19 ++++++-
 .../common/utils/applicationstest.py               |   55 ++++----------------
 .../common/utils/expectedFailure.py                |    3 +-
 tests/functional-tests/common/utils/helpers.py     |   23 ++++-----
 tests/functional-tests/common/utils/storetest.py   |   36 +++++++------
 tests/functional-tests/common/utils/system.py      |   28 +++++-----
 .../functional-tests/common/utils/writebacktest.py |    5 ++-
 ...00-backup-restore.py => test_backup_restore.py} |    0
 .../store/{05-coalesce.py => test_coalesce.py}     |    4 ++
 .../store/{16-collation.py => test_collation.py}   |    3 +-
 ...oncurrent-query.py => test_concurrent_query.py} |    4 ++
 .../store/{06-distance.py => test_distance.py}     |    4 ++
 .../{03-fts-functions.py => test_fts_functions.py} |    0
 .../store/{07-graph.py => test_graph.py}           |    0
 .../{04-group-concat.py => test_group_concat.py}   |    0
 .../store/{01-insertion.py => test_insertion.py}   |    0
 ...ntology-changes.py => test_ontology_changes.py} |    8 +++-
 .../store/{14-signals.py => test_signals.py}       |    4 ++
 .../{02-sparql-bugs.py => test_sparql_bugs.py}     |    0
 ...tch-misused.py => test_sqlite_batch_misused.py} |    0
 ...10-sqlite-misused.py => test_sqlite_misused.py} |    2 +
 .../store/{15-statistics.py => test_statistics.py} |    5 ++-
 ...13-threaded-store.py => test_threaded_store.py} |    2 +
 .../{12-transactions.py => test_transactions.py}   |    4 ++
 ...que-insertions.py => test_unique_insertions.py} |    0
 25 files changed, 115 insertions(+), 94 deletions(-)
---
diff --git a/tests/functional-tests/apps/test_camera.py b/tests/functional-tests/apps/test_camera.py
old mode 100755
new mode 100644
diff --git a/tests/functional-tests/apps/test_sync.py b/tests/functional-tests/apps/test_sync.py
old mode 100755
new mode 100644
diff --git a/tests/functional-tests/common/__init__.py b/tests/functional-tests/common/__init__.py
index 013e4b7..2ad2bab 100644
--- a/tests/functional-tests/common/__init__.py
+++ b/tests/functional-tests/common/__init__.py
@@ -1 +1,18 @@
-#!/usr/bin/python
+# Copyright (C) 2014, Sam Thursfield <sam afuera me uk>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+import testcase
diff --git a/tests/functional-tests/common/utils/applicationstest.py 
b/tests/functional-tests/common/utils/applicationstest.py
index 708ee36..84ebfee 100644
--- a/tests/functional-tests/common/utils/applicationstest.py
+++ b/tests/functional-tests/common/utils/applicationstest.py
@@ -17,6 +17,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301, USA.
 #
+
 from common.utils import configuration as cfg
 from common.utils.system import TrackerSystemAbstraction
 from common.utils.helpers import log
@@ -28,6 +29,9 @@ import shutil
 import os
 import time
 
+import common
+
+
 APPLICATIONS_TMP_DIR = os.path.join(
     cfg.TEST_MONITORED_TMP_DIR, "test-applications-monitored")
 
@@ -48,49 +52,9 @@ SLOWCOPY_RATE = 1024
 import subprocess
 import tempfile
 
-class TrackerTestCase(ut.TestCase):
-    '''Base class for all Tracker functional tests.
-
-    This class handles isolating each test case from both other test cases and
-    from the host system.
-
-    '''
-    def setUp(self):
-        self._old_environ = os.environ
-
-        self.fake_home()
-        self.launch_session_bus()
-
-    def fake_home(self):
-        self.tempdir = tempfile.mkdtemp(prefix='tracker-test')
-
-        # We need to use the actual home directory for some tests because
-        # Tracker will explicitly ignore files in /tmp ...
-        os.environ['REAL_HOME'] = os.path.expanduser('~')
 
-        # ... but /tmp is preferred for test data, to avoid leaving debris
-        # in the filesystem
-        os.environ['HOME'] = self.tempdir
-        log("HOME=%s" % self.tempdir)
+class CommonTrackerApplicationTest (common.TestCase):
 
-    def launch_session_bus(self):
-        self.dbus_process = subprocess.Popen(
-            ["dbus-daemon", "--session", "--print-address=1", "--fork"],
-            stdout=subprocess.PIPE)
-        self.dbus_address = self.dbus_process.stdout.readline().rstrip()
-
-        os.environ['DBUS_SESSION_BUS_ADDRESS'] = self.dbus_address
-        log("DBUS_SESSION_BUS_ADDRESS=%s" % self.dbus_address)
-
-    def tearDown(self):
-        log('Stopping D-Bus daemon (PID %i) ...' % (self.dbus_process.pid))
-        self.dbus_process.terminate()
-        self.dbus_process.wait()
-
-        os.environ = self._old_environ
-
-
-class CommonTrackerApplicationTest(TrackerTestCase):
     def get_urn_count_by_url(self, url):
         select = """
         SELECT ?u WHERE { ?u nie:url \"%s\" }
@@ -155,7 +119,7 @@ class CommonTrackerApplicationTest(TrackerTestCase):
                                         "test-apps-data")
 
         self.system = TrackerSystemAbstraction()
-        self.system.tracker_all_testing_start(CONF_OPTIONS)
+        self.system.tracker_all_testing_start(CONF_OPTIONS, self.dbus_address)
 
         # Returns when ready
         self.tracker = self.system.store
@@ -163,10 +127,11 @@ class CommonTrackerApplicationTest(TrackerTestCase):
         log("Ready to go!")
 
     def tearDown(self):
-        self.system.tracker_all_testing_stop ()
+        # print "Stopping the daemon in test mode (Doing nothing now)"
+        self.system.tracker_all_testing_stop()
 
         # Remove monitored directory
-        if (os.path.exists (APPLICATIONS_TMP_DIR)):
-            shutil.rmtree (APPLICATIONS_TMP_DIR)
+        if (os.path.exists(APPLICATIONS_TMP_DIR)):
+            shutil.rmtree(APPLICATIONS_TMP_DIR)
 
         super(CommonTrackerApplicationTest, self).tearDown()
diff --git a/tests/functional-tests/common/utils/expectedFailure.py 
b/tests/functional-tests/common/utils/expectedFailure.py
index de1a8c8..a222cba 100644
--- a/tests/functional-tests/common/utils/expectedFailure.py
+++ b/tests/functional-tests/common/utils/expectedFailure.py
@@ -27,9 +27,10 @@ on the files. Note that these tests are highly platform dependant.
 """
 import sys
 import unittest as ut
-from unittest.compatibility import wraps
 import configuration as cfg
 
+from functools import wraps
+
 
 def expectedFailureBug(bugnumber):
     """
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index a4e1c10..ce204c4 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -81,17 +81,13 @@ class Helper:
             sys.exit()
         sys.excepthook = new_hook
 
-    def _get_bus(self):
-        if self.bus is not None:
-            log ("--- return existing bus %s" % self.bus)
-            return
-
+    def _get_bus(self, dbus_address):
         self.loop = GObject.MainLoop()
 
         self.install_glib_excepthook(self.loop)
 
         dbus_loop = DBusGMainLoop(set_as_default=True)
-        self.bus = dbus.SessionBus(dbus_loop)
+        self.bus = dbus.bus.BusConnection(dbus_address, mainloop=dbus_loop)
 
         obj = self.bus.get_object("org.freedesktop.DBus",
                                   "/org/freedesktop/DBus")
@@ -151,12 +147,13 @@ class Helper:
         self.timeout_id = None
         return False
 
-    def start(self):
+    def start(self, dbus_address):
         """
         Start an instance of process and wait for it to appear on the bus.
         """
 
-        self._get_bus()
+        if self.bus is None:
+            self._get_bus(dbus_address)
 
         if (self.bus_admin.NameHasOwner(self.BUS_NAME)):
             raise Exception(
@@ -186,7 +183,7 @@ class Helper:
             pdb.set_trace()
             raise Exception(
                 "%s did not appear on message bus after %i seconds." % (
-                self.BUS_NAME, REASONABLE_TIMEOUT))
+                    self.BUS_NAME, REASONABLE_TIMEOUT))
 
         self.abort_if_process_exits_with_status_0 = False
 
@@ -238,8 +235,8 @@ class StoreHelper (Helper):
 
     graph_updated_handler_id = 0
 
-    def start(self):
-        Helper.start(self)
+    def start(self, dbus_address):
+        Helper.start(self, dbus_address)
 
         tracker = self.bus.get_object(cfg.TRACKER_BUSNAME,
                                       cfg.TRACKER_OBJ_PATH)
@@ -635,8 +632,8 @@ class MinerFsHelper (Helper):
     if cfg.haveMaemo:
         FLAGS.append('--disable-miner=userguides')
 
-    def start(self):
-        Helper.start(self)
+    def start(self, dbus_address):
+        Helper.start(self, dbus_address)
 
         bus_object = self.bus.get_object(cfg.MINERFS_BUSNAME,
                                          cfg.MINERFS_OBJ_PATH)
diff --git a/tests/functional-tests/common/utils/storetest.py 
b/tests/functional-tests/common/utils/storetest.py
index b585b91..686471b 100644
--- a/tests/functional-tests/common/utils/storetest.py
+++ b/tests/functional-tests/common/utils/storetest.py
@@ -27,20 +27,24 @@ from common.utils import configuration as cfg
 
 import unittest as ut
 
+import common
 
-class CommonTrackerStoreTest (ut.TestCase):
-
-    """
-    Common superclass for tests that just require a fresh store running
-    """
-    @classmethod
-    def setUpClass(self):
-        # print "Starting the daemon in test mode"
-        self.system = TrackerSystemAbstraction()
-        self.system.tracker_store_testing_start()
-        self.tracker = self.system.store
-
-    @classmethod
-    def tearDownClass(self):
-        # print "Stopping the daemon in test mode (Doing nothing now)"
-        self.system.tracker_store_testing_stop()
+
+class CommonTrackerStoreTest (common.testcase.TrackerTestCase):
+
+        """
+        Common superclass for tests that just require a fresh store running
+        """
+
+        def setUp(self):
+            super(CommonTrackerStoreTest, self).setUp()
+
+            self.system = TrackerSystemAbstraction()
+            self.system.tracker_store_testing_start(
+                dbus_address=self.dbus_address)
+            self.tracker = self.system.store
+
+        def tearDown(self):
+            self.system.tracker_store_testing_stop()
+
+            super(CommonTrackerStoreTest, self).tearDown()
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index 539d5de..bcbe499 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -80,15 +80,15 @@ class TrackerSystemAbstraction:
             for key, value in contents.iteritems():
                 dconf.write(key, value)
 
-    def tracker_store_testing_start(self, confdir=None, ontodir=None):
+    def tracker_store_testing_start(self, config=None, ontodir=None, dbus_address=None):
         """
         Stops any previous instance of the store, calls set_up_environment,
         and starts a new instances of the store
         """
-        self.set_up_environment(confdir, ontodir)
+        self.set_up_environment(config, ontodir)
 
         self.store = helpers.StoreHelper()
-        self.store.start()
+        self.store.start(dbus_address)
 
     def tracker_store_start(self):
         self.store.start()
@@ -151,22 +151,21 @@ class TrackerSystemAbstraction:
         assert self.store
         self.store.stop()
 
-    def tracker_miner_fs_testing_start(self, confdir=None):
+    def tracker_miner_fs_testing_start(self, config, dbus_address):
         """
         Stops any previous instance of the store and miner, calls set_up_environment,
         and starts a new instance of the store and miner-fs
         """
-        self.set_up_environment(confdir, None)
+        self.set_up_environment(config, None)
 
-        # Start also the store. DBus autoactivation ignores the env variables.
         self.store = helpers.StoreHelper()
-        self.store.start()
+        self.store.start(dbus_address)
 
         self.extractor = helpers.ExtractorHelper()
-        self.extractor.start()
+        self.extractor.start(dbus_address)
 
         self.miner_fs = helpers.MinerFsHelper()
-        self.miner_fs.start()
+        self.miner_fs.start(dbus_address)
 
     def tracker_miner_fs_testing_stop(self):
         """
@@ -176,20 +175,21 @@ class TrackerSystemAbstraction:
         self.miner_fs.stop()
         self.store.stop()
 
-    def tracker_writeback_testing_start(self, confdir=None):
+    def tracker_writeback_testing_start(self, config, dbus_address):
         # Start the miner-fs (and store) and then the writeback process
-        self.tracker_miner_fs_testing_start(confdir)
+        self.tracker_miner_fs_testing_start(config, dbus_address)
         self.writeback = helpers.WritebackHelper()
-        self.writeback.start()
+        self.writeback.start(dbus_address)
 
     def tracker_writeback_testing_stop(self):
         # Tracker write must have been started before
         self.writeback.stop()
+
         self.tracker_miner_fs_testing_stop()
 
-    def tracker_all_testing_start(self, confdir=None):
+    def tracker_all_testing_start(self, config, dbus_address):
         # This will start all miner-fs, store and writeback
-        self.tracker_writeback_testing_start(confdir)
+        self.tracker_writeback_testing_start(config, dbus_address)
 
     def tracker_all_testing_stop(self):
         # This will stop all miner-fs, store and writeback
diff --git a/tests/functional-tests/common/utils/writebacktest.py 
b/tests/functional-tests/common/utils/writebacktest.py
index 677570f..05156d5 100644
--- a/tests/functional-tests/common/utils/writebacktest.py
+++ b/tests/functional-tests/common/utils/writebacktest.py
@@ -28,6 +28,9 @@ from common.utils import configuration as cfg
 from common.utils.helpers import log
 import time
 
+import common
+
+
 TEST_FILE_JPEG = "writeback-test-1.jpeg"
 TEST_FILE_TIFF = "writeback-test-2.tif"
 TEST_FILE_PNG = "writeback-test-4.png"
@@ -49,7 +52,7 @@ def uri(filename):
     return "file://" + os.path.join(WRITEBACK_TMP_DIR, filename)
 
 
-class CommonTrackerWritebackTest (ut.TestCase):
+class CommonTrackerWritebackTest (common.TestCase):
 
     """
     Superclass to share methods. Shouldn't be run by itself.
diff --git a/tests/functional-tests/store/200-backup-restore.py 
b/tests/functional-tests/store/test_backup_restore.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/200-backup-restore.py
rename to tests/functional-tests/store/test_backup_restore.py
diff --git a/tests/functional-tests/store/05-coalesce.py b/tests/functional-tests/store/test_coalesce.py
old mode 100755
new mode 100644
similarity index 97%
rename from tests/functional-tests/store/05-coalesce.py
rename to tests/functional-tests/store/test_coalesce.py
index 6338014..b90f6ae
--- a/tests/functional-tests/store/05-coalesce.py
+++ b/tests/functional-tests/store/test_coalesce.py
@@ -38,6 +38,8 @@ class TestCoalesce (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TestCoalesce, self).setUp()
+
         self.resource_uri = "contact://test_group_concat"
 
         #
@@ -57,6 +59,8 @@ class TestCoalesce (CommonTrackerStoreTest):
         """ % (self.resource_uri)
         self.tracker.update(delete)
 
+        super(TestCoalesce, self).tearDown()
+
     def test_coalesce_first_fine(self):
         """
         setUp: Insert a contact with only some text properties set
diff --git a/tests/functional-tests/store/16-collation.py b/tests/functional-tests/store/test_collation.py
old mode 100755
new mode 100644
similarity index 97%
rename from tests/functional-tests/store/16-collation.py
rename to tests/functional-tests/store/test_collation.py
index 8be6cdf..ed8a46e
--- a/tests/functional-tests/store/16-collation.py
+++ b/tests/functional-tests/store/test_collation.py
@@ -43,13 +43,14 @@ class TrackerStoreCollationTests (CommonTrackerStoreTest):
         Each test append to this list the used URIS, so they can be removed
         in the tearDown
         """
+        super(TrackerStoreCollationTests, self).setUp()
         self.clean_up_instances = []
 
     def tearDown(self):
         for uri in self.clean_up_instances:
             self.tracker.update("DELETE { <%s> a rdfs:Resource. }" % (uri))
         self.clean_up_instances = []
-        time.sleep(1)
+        super(TrackerStoreCollationTests, self).tearDown()
 
     def __insert_text(self, text):
         uri = "test://collation-01-%d" % (random.randint(1, 1000))
diff --git a/tests/functional-tests/store/09-concurrent-query.py 
b/tests/functional-tests/store/test_concurrent_query.py
old mode 100755
new mode 100644
similarity index 97%
rename from tests/functional-tests/store/09-concurrent-query.py
rename to tests/functional-tests/store/test_concurrent_query.py
index 57a00c4..2cfca60
--- a/tests/functional-tests/store/09-concurrent-query.py
+++ b/tests/functional-tests/store/test_concurrent_query.py
@@ -47,6 +47,8 @@ class TestConcurrentQuery (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TestConcurrentQuery, self).setUp()
+
         self.main_loop = GObject.MainLoop()
 
         self.mock_data_insert()
@@ -60,6 +62,8 @@ class TestConcurrentQuery (CommonTrackerStoreTest):
         query += "}"
         self.tracker.update(query)
 
+        super(TestConcurrentQuery, self).tearDown()
+
     def mock_data_delete(self):
         query = "DELETE {\n"
         for i in range(0, AMOUNT_OF_TEST_INSTANCES):
diff --git a/tests/functional-tests/store/06-distance.py b/tests/functional-tests/store/test_distance.py
old mode 100755
new mode 100644
similarity index 97%
rename from tests/functional-tests/store/06-distance.py
rename to tests/functional-tests/store/test_distance.py
index bd19933..4a09ad4
--- a/tests/functional-tests/store/06-distance.py
+++ b/tests/functional-tests/store/test_distance.py
@@ -40,6 +40,8 @@ class TestDistanceFunctions (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TestDistanceFunctions, self).setUp()
+
         self.counter = 0
         for lat, log in POINT_COORDS:
             insert = """
@@ -61,6 +63,8 @@ class TestDistanceFunctions (CommonTrackerStoreTest):
             """ % ("point://test/point/" + str (i))
             self.tracker.update(delete)
 
+        super(TestDistanceFunctions, self).tearDown()
+
     def get_distance_between_points(self, sum_func, id1, id2):
 
         assert 0 <= id1 <= len(POINT_COORDS)
diff --git a/tests/functional-tests/store/03-fts-functions.py 
b/tests/functional-tests/store/test_fts_functions.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/03-fts-functions.py
rename to tests/functional-tests/store/test_fts_functions.py
diff --git a/tests/functional-tests/store/07-graph.py b/tests/functional-tests/store/test_graph.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/07-graph.py
rename to tests/functional-tests/store/test_graph.py
diff --git a/tests/functional-tests/store/04-group-concat.py 
b/tests/functional-tests/store/test_group_concat.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/04-group-concat.py
rename to tests/functional-tests/store/test_group_concat.py
diff --git a/tests/functional-tests/store/01-insertion.py b/tests/functional-tests/store/test_insertion.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/01-insertion.py
rename to tests/functional-tests/store/test_insertion.py
diff --git a/tests/functional-tests/store/17-ontology-changes.py 
b/tests/functional-tests/store/test_ontology_changes.py
old mode 100755
new mode 100644
similarity index 99%
rename from tests/functional-tests/store/17-ontology-changes.py
rename to tests/functional-tests/store/test_ontology_changes.py
index 3728b59..a38cc2d
--- a/tests/functional-tests/store/17-ontology-changes.py
+++ b/tests/functional-tests/store/test_ontology_changes.py
@@ -33,6 +33,8 @@ from common.utils.system import UnableToBootException as UnableToBootException
 from common.utils.helpers import StoreHelper as StoreHelper
 from common.utils.expectedFailure import expectedFailureBug, expectedFailureJournal
 
+import common
+
 
 RDFS_RANGE = "http://www.w3.org/2000/01/rdf-schema#range";
 XSD_DATETIME = "http://www.w3.org/2001/XMLSchema#dateTime";
@@ -45,7 +47,7 @@ import re
 import time
 
 
-class OntologyChangeTestTemplate (ut.TestCase):
+class OntologyChangeTestTemplate (common.testcase.TrackerTestCase):
 
     """
     Template class for the ontology changes tests. The tests are subclasses
@@ -70,11 +72,15 @@ class OntologyChangeTestTemplate (ut.TestCase):
                                 "test-ontologies", param)
 
     def setUp(self):
+        super(OntologyChangeTestTemplate, self).setUp()
+
         self.system = TrackerSystemAbstraction()
 
     def tearDown(self):
         self.system.tracker_store_testing_stop()
 
+        super(OntologyChangeTestTemplate, self).tearDown()
+
     def template_test_ontology_change(self):
 
         self.set_ontology_dirs()
diff --git a/tests/functional-tests/store/14-signals.py b/tests/functional-tests/store/test_signals.py
old mode 100755
new mode 100644
similarity index 98%
rename from tests/functional-tests/store/14-signals.py
rename to tests/functional-tests/store/test_signals.py
index 4b49c52..bf2f697
--- a/tests/functional-tests/store/14-signals.py
+++ b/tests/functional-tests/store/test_signals.py
@@ -51,6 +51,8 @@ class TrackerStoreSignalsTests (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TrackerStoreSignalsTests, self).setUp()
+
         self.clean_up_list = []
         self.loop = GObject.MainLoop()
         dbus_loop = DBusGMainLoop(set_as_default=True)
@@ -67,6 +69,8 @@ class TrackerStoreSignalsTests (CommonTrackerStoreTest):
 
         self.clean_up_list = []
 
+        super(TrackerStoreSignalsTests, self).tearDown()
+
     def __connect_signal(self):
         """
         After connecting to the signal, call self.__wait_for_signal.
diff --git a/tests/functional-tests/store/02-sparql-bugs.py b/tests/functional-tests/store/test_sparql_bugs.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/02-sparql-bugs.py
rename to tests/functional-tests/store/test_sparql_bugs.py
diff --git a/tests/functional-tests/store/11-sqlite-batch-misused.py 
b/tests/functional-tests/store/test_sqlite_batch_misused.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/11-sqlite-batch-misused.py
rename to tests/functional-tests/store/test_sqlite_batch_misused.py
diff --git a/tests/functional-tests/store/10-sqlite-misused.py 
b/tests/functional-tests/store/test_sqlite_misused.py
old mode 100755
new mode 100644
similarity index 98%
rename from tests/functional-tests/store/10-sqlite-misused.py
rename to tests/functional-tests/store/test_sqlite_misused.py
index 352d4b3..58e7cc8
--- a/tests/functional-tests/store/10-sqlite-misused.py
+++ b/tests/functional-tests/store/test_sqlite_misused.py
@@ -38,6 +38,8 @@ class TestSqliteMisused (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(CommonTrackerStoreTest, self).setUp()
+
         self.main_loop = GObject.MainLoop()
         self.files_counter = 0
 
diff --git a/tests/functional-tests/store/15-statistics.py b/tests/functional-tests/store/test_statistics.py
old mode 100755
new mode 100644
similarity index 97%
rename from tests/functional-tests/store/15-statistics.py
rename to tests/functional-tests/store/test_statistics.py
index af9dee5..86c2ce0
--- a/tests/functional-tests/store/15-statistics.py
+++ b/tests/functional-tests/store/test_statistics.py
@@ -50,13 +50,16 @@ class TrackerStoreStatisticsTests (CommonTrackerStoreTest):
         Each test append to this list the used URIS, so they can be removed
         in the tearDown
         """
+        super(TrackerStoreStatisticsTests, self).setUp()
+
         self.clean_up_instances = []
 
     def tearDown(self):
         for uri in self.clean_up_instances:
             self.tracker.update("DELETE { <%s> a rdfs:Resource. }" % (uri))
         self.clean_up_instances = []
-        time.sleep(1)
+
+        super(TrackerStoreStatisticsTests, self).tearDown()
 
     def test_stats_01_insert_base_class(self):
         self.clean_up_instances.append("test://stats-01")
diff --git a/tests/functional-tests/store/13-threaded-store.py 
b/tests/functional-tests/store/test_threaded_store.py
old mode 100755
new mode 100644
similarity index 99%
rename from tests/functional-tests/store/13-threaded-store.py
rename to tests/functional-tests/store/test_threaded_store.py
index 993a8c8..5bc6829
--- a/tests/functional-tests/store/13-threaded-store.py
+++ b/tests/functional-tests/store/test_threaded_store.py
@@ -51,6 +51,8 @@ class TestThreadedStore (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TestThreadedStore, self).setUp()
+
         self.main_loop = GObject.MainLoop()
         self.simple_queries_counter = AMOUNT_SIMPLE_QUERIES
         self.simple_queries_answers = 0
diff --git a/tests/functional-tests/store/12-transactions.py 
b/tests/functional-tests/store/test_transactions.py
old mode 100755
new mode 100644
similarity index 96%
rename from tests/functional-tests/store/12-transactions.py
rename to tests/functional-tests/store/test_transactions.py
index 33b9bdc..1f3ef95
--- a/tests/functional-tests/store/12-transactions.py
+++ b/tests/functional-tests/store/test_transactions.py
@@ -43,6 +43,8 @@ class TrackerTransactionsTest (CommonTrackerStoreTest):
     """
 
     def setUp(self):
+        super(TrackerTransactionsTest, self).setUp()
+
         self.instance_counter = 0
 
     def tearDown(self):
@@ -52,6 +54,8 @@ class TrackerTransactionsTest (CommonTrackerStoreTest):
                             timeout=60000)
         self.instance_counter = 0
 
+        super(TrackerTransactionsTest, self).tearDown()
+
     def insert_and_commit(self, number):
         insert_sparql = "INSERT {\n"
         for i in range(0, number):
diff --git a/tests/functional-tests/store/08-unique-insertions.py 
b/tests/functional-tests/store/test_unique_insertions.py
old mode 100755
new mode 100644
similarity index 100%
rename from tests/functional-tests/store/08-unique-insertions.py
rename to tests/functional-tests/store/test_unique_insertions.py


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