summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2014-12-30 16:18:43 +0000
committerSam Thursfield <sam@afuera.me.uk>2014-12-30 16:18:43 +0000
commitf885a4cf0b201ca29741bfb108b1757e305e5d97 (patch)
treec5129a017672a3abf5b1f1e2a99b9604ad0ac4fd
parentbadd158bcc690f463150de4a637cb6cf41f9760f (diff)
downloadtracker-f885a4cf0b201ca29741bfb108b1757e305e5d97.tar.gz
extractor testcases
-rw-r--r--tests/functional-tests/common/utils/options.py80
-rw-r--r--tests/functional-tests/extractor/__init__.py30
-rw-r--r--tests/functional-tests/extractor/extractor_testcase.py213
-rw-r--r--tests/functional-tests/extractor/parser.py (renamed from tests/functional-tests/extractor/testcase.py)13
-rw-r--r--[-rwxr-xr-x]tests/functional-tests/extractor/test_extractor.py258
-rw-r--r--tests/functional-tests/store/__init__.py4
-rw-r--r--tests/functional-tests/store/store_testcase.py (renamed from tests/functional-tests/store/testcase.py)0
-rw-r--r--tests/functional-tests/store/test_backup_restore.py6
-rw-r--r--tests/functional-tests/store/test_coalesce.py4
-rw-r--r--tests/functional-tests/store/test_collation.py4
-rw-r--r--tests/functional-tests/store/test_concurrent_query.py4
-rw-r--r--tests/functional-tests/store/test_distance.py4
-rw-r--r--tests/functional-tests/store/test_fts_functions.py4
-rw-r--r--tests/functional-tests/store/test_graph.py4
-rw-r--r--tests/functional-tests/store/test_group_concat.py4
-rw-r--r--tests/functional-tests/store/test_insertion.py10
-rw-r--r--tests/functional-tests/store/test_signals.py4
-rw-r--r--tests/functional-tests/store/test_sparql_bugs.py4
-rw-r--r--tests/functional-tests/store/test_sqlite_batch_misused.py4
-rw-r--r--tests/functional-tests/store/test_sqlite_misused.py6
-rw-r--r--tests/functional-tests/store/test_statistics.py4
-rw-r--r--tests/functional-tests/store/test_threaded_store.py4
-rw-r--r--tests/functional-tests/store/test_transactions.py4
-rw-r--r--tests/functional-tests/store/test_unique_insertions.py4
24 files changed, 355 insertions, 321 deletions
diff --git a/tests/functional-tests/common/utils/options.py b/tests/functional-tests/common/utils/options.py
index 7bbfad9c1..a7dfdd502 100644
--- a/tests/functional-tests/common/utils/options.py
+++ b/tests/functional-tests/common/utils/options.py
@@ -1,40 +1,40 @@
-from optparse import OptionParser
-import sys
-
-usage = "usage: %prog [options]"
-
-parser = OptionParser(usage=usage)
-
-parser.add_option("-m", "--start-manually", dest="startmanually",
- action="store_true",
- default=False,
- help="Wait for an external instance of the processes to appear in the system")
-
-parser.add_option("-v", "--verbose", dest="verbose",
- action="store_true",
- default=False,
- help="Display a log of test process statuses")
-
-(options, args) = parser.parse_args()
-
-# Deleting options from the args. Otherwise unittest and the tests which
-# have their own simple commandline parsers will complain
-for option in ["--startmanually", "-m", "--verbose", "-v"]:
- try:
- sys.argv.remove(option)
- except ValueError:
- pass
-
-
-def is_verbose():
- """
- True to log process status information to stdout
- """
- return options.verbose
-
-
-def is_manual_start():
- """
- False to start the processes automatically
- """
- return options.startmanually
+#from optparse import OptionParser
+#import sys
+#
+#usage = "usage: %prog [options]"
+#
+#parser = OptionParser(usage=usage)
+#
+#parser.add_option("-m", "--start-manually", dest="startmanually",
+# action="store_true",
+# default=False,
+# help="Wait for an external instance of the processes to appear in the system")
+#
+#parser.add_option("-v", "--verbose", dest="verbose",
+# action="store_true",
+# default=False,
+# help="Display a log of test process statuses")
+#
+#(options, args) = parser.parse_args()
+#
+## Deleting options from the args. Otherwise unittest and the tests which
+## have their own simple commandline parsers will complain
+#for option in ["--startmanually", "-m", "--verbose", "-v"]:
+# try:
+# sys.argv.remove(option)
+# except ValueError:
+# pass
+#
+#
+#def is_verbose():
+# """
+# True to log process status information to stdout
+# """
+# return options.verbose
+#
+#
+#def is_manual_start():
+# """
+# False to start the processes automatically
+# """
+# return options.startmanually
diff --git a/tests/functional-tests/extractor/__init__.py b/tests/functional-tests/extractor/__init__.py
index 61b258f1e..0aba45b8b 100644
--- a/tests/functional-tests/extractor/__init__.py
+++ b/tests/functional-tests/extractor/__init__.py
@@ -1,3 +1,27 @@
-"""
-This module contains functional tests for Tracker.
-"""
+# 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.
+
+
+# Including all tests in this file ensures that they can be run with
+# `python -m unittest module` as well as `python -m unittest discover module`.
+
+
+import test_extractor
+
+
+def load_tests(loader, standard_tests, pattern):
+ return test_extractor.load_tests(loader, standard_tests, pattern)
diff --git a/tests/functional-tests/extractor/extractor_testcase.py b/tests/functional-tests/extractor/extractor_testcase.py
new file mode 100644
index 000000000..1f18a2f2f
--- /dev/null
+++ b/tests/functional-tests/extractor/extractor_testcase.py
@@ -0,0 +1,213 @@
+# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
+# 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 ConfigParser
+import os
+import sys
+import unittest
+
+
+import parser
+
+from common.utils import configuration as cfg
+
+
+class ExtractorTestCase (unittest.TestCase):
+ """
+ Test checks if the tracker extractor is able to retrieve metadata
+ """
+
+ def __init__(self, methodName='runTest', descfile=None):
+ """
+ Descfile is the description file in a relative path
+ """
+ unittest.TestCase.__init__(self, methodName)
+
+ # Load the description file
+ assert descfile
+ self.rel_description = descfile
+ self.configParser = self.__load_description_file(self.rel_description)
+
+ # Add a method to the class called after the description file
+ methodName = self.rel_description.lower()[
+ :-len(".expected")].replace(" ", "_")[-60:]
+
+ if (self.__is_expected_failure()):
+ setattr(self,
+ methodName,
+ self.expected_failure_test_extraction)
+ else:
+ setattr(self,
+ methodName,
+ self.generic_test_extraction)
+
+ # unittest framework will run the test called "self._testMethodName"
+ # So we set that variable to our new name
+ self._testMethodName = methodName
+
+ def runTest(self):
+ """
+ Empty function pointer, that should NEVER be called. It is required to exist by unittest.
+ """
+ assert False
+
+ def __load_description_file(self, descfile):
+ configParser = ConfigParser.RawConfigParser()
+ # Make it case sensitive:
+ configParser.optionxform = str
+
+ abs_description = os.path.abspath(descfile)
+ loaded_files = configParser.read(abs_description)
+ if not abs_description in loaded_files:
+ raise Exception("Unable to load %s" % (abs_description))
+
+ return configParser
+
+ def __is_expected_failure(self):
+ assert self.configParser
+ return self.configParser.has_option("TestFile", "ExpectedFailure")
+
+ def __get_bugnumber(self):
+ assert self.configParser
+ if self.configParser.has_option("TestFile", "Bugzilla"):
+ return "'" + self.configParser.get("TestFile", "Bugzilla") + "'"
+ else:
+ return None
+
+ def expected_failure_test_extraction(self):
+ try:
+ self.generic_test_extraction()
+ except Exception:
+ raise unittest.case._ExpectedFailure(sys.exc_info())
+
+ if self.__get_bugnumber():
+ raise Exception(
+ "Unexpected success. Maybe bug: " + self.__get_bugnumber() + " has been fixed?")
+ else:
+ raise Exception(
+ "Unexpected success. Check " + self.rel_description)
+
+ def generic_test_extraction(self):
+ abs_description = os.path.abspath(self.rel_description)
+
+ # Filename contains the file to extract, in a relative path to the
+ # description file
+ desc_root, desc_file = os.path.split(abs_description)
+
+ filename_to_extract = self.configParser.get("TestFile", "Filename")
+ self.file_to_extract = os.path.join(desc_root, filename_to_extract)
+
+ result = parser.get_tracker_extract_output(self.file_to_extract)
+ self.__assert_extraction_ok(result)
+
+ def assertDictHasKey(self, d, key, msg=None):
+ if not d.has_key(key):
+ standardMsg = "Missing: %s\n" % (key)
+ self.fail(self._formatMessage(msg, standardMsg))
+ else:
+ return
+
+ def assertIsURN(self, supposed_uuid, msg=None):
+ import uuid
+
+ try:
+ if (supposed_uuid.startswith("<") and supposed_uuid.endswith(">")):
+ supposed_uuid = supposed_uuid[1:-1]
+
+ uuid.UUID(supposed_uuid)
+ except ValueError:
+ standardMsg = "'%s' is not a valid UUID" % (supposed_uuid)
+ self.fail(self._formatMessage(msg, standardMsg))
+
+ def __assert_extraction_ok(self, result):
+ self.__check_section("Metadata", result)
+
+ if (cfg.haveMaemo and self.configParser.has_section("Meego")):
+ self.__check_section("Meego", result)
+
+ def __check_section(self, section, result):
+ error_missing_prop = "Property '%s' hasn't been extracted from file \n'%s'\n (requested on '%s' [%s])"
+ error_wrong_value = "on property '%s' from file %s\n (requested on: '%s' [%s])"
+ error_extra_prop = "Property '%s' was explicitely banned for file \n'%s'\n (requested on '%s' [%s])"
+ error_extra_prop_v = "Property '%s' with value '%s' was explicitely banned for file \n'%s'\n (requested on %s' [%s])"
+
+ expected_pairs = [] # List of expected (key, value)
+ unexpected_pairs = [] # List of unexpected (key, value)
+ expected_keys = []
+ # List of expected keys (the key must be there, value doesnt
+ # matter)
+
+ for k, v in self.configParser.items(section):
+ if k.startswith("!"):
+ unexpected_pairs.append((k[1:].replace("_", ":"), v))
+ elif k.startswith("@"):
+ expected_keys.append(k[1:].replace("_", ":"))
+ else:
+ expected_pairs.append((k.replace("_", ":"), v))
+
+ for (prop, value) in expected_pairs:
+ self.assertDictHasKey(result, prop,
+ error_missing_prop % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+ if value == "@URNUUID@":
+ # Watch out! We take only the FIRST element. Incompatible with
+ # multiple-valued props.
+ self.assertIsURN(result[prop][0],
+ error_wrong_value % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+ else:
+ self.assertIn(value, result[prop],
+ error_wrong_value % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+
+ for (prop, value) in unexpected_pairs:
+ # There is no prop, or it is but not with that value
+ if (value == ""):
+ self.assertFalse(
+ result.has_key(prop), error_extra_prop % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+ else:
+ if (value == "@URNUUID@"):
+ self.assertIsURN(
+ result[prop][0], error_extra_prop % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+ else:
+ self.assertNotIn(
+ value, result[prop], error_extra_prop_v % (prop,
+ value,
+ self.file_to_extract,
+ self.rel_description,
+ section))
+
+ for prop in expected_keys:
+ self.assertDictHasKey(result, prop,
+ error_missing_prop % (prop,
+ self.file_to_extract,
+ self.rel_description,
+ section))
diff --git a/tests/functional-tests/extractor/testcase.py b/tests/functional-tests/extractor/parser.py
index 36ed0b744..c68841faf 100644
--- a/tests/functional-tests/extractor/testcase.py
+++ b/tests/functional-tests/extractor/parser.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python
-#
# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
#
# This program is free software; you can redistribute it and/or
@@ -16,17 +14,18 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
-#
-from common.utils import configuration as cfg
-from common.utils.helpers import log
+
import os
import re
import subprocess
+from logging import info
-class ExtractorParser(object):
+from common.utils import configuration as cfg
+
+class ExtractorParser(object):
def parse_tracker_extract_output(self, text):
"""
Parse stdout of `tracker-extract --file` to get SPARQL statements.
@@ -269,7 +268,7 @@ def get_tracker_extract_output(filename, mime_type=None):
command.extend(['--mime', mime_type])
try:
- log('Running: %s' % ' '.join(command))
+ info('Running: %s' % ' '.join(command))
output = subprocess.check_output(command)
except subprocess.CalledProcessError as e:
raise Exception("Error %i from tracker-extract, output: %s" %
diff --git a/tests/functional-tests/extractor/test_extractor.py b/tests/functional-tests/extractor/test_extractor.py
index e29c2754b..f3940f9c0 100755..100644
--- a/tests/functional-tests/extractor/test_extractor.py
+++ b/tests/functional-tests/extractor/test_extractor.py
@@ -1,6 +1,5 @@
-#!/usr/bin/python
-#
# Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
+# 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
@@ -16,257 +15,52 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
-#
+
+
"""
For a collection of files, call the extractor and check that the expected
-metadata is extracted. Load dynamically the test information from a data
+ metadata is extracted. Load dynamically the test information from a data
directory (containing xxx.expected files)
"""
-from common.utils import configuration as cfg
-from common.utils.extractor import get_tracker_extract_output
-import unittest as ut
-import os
-import sys
-
-import ConfigParser
-
-
-class ExtractionTestCase (ut.TestCase):
-
- """
- Test checks if the tracker extractor is able to retrieve metadata
- """
-
- def __init__(self, methodName='runTest', descfile=None):
- """
- Descfile is the description file in a relative path
- """
- ut.TestCase.__init__(self, methodName)
-
- # Load the description file
- assert descfile
- self.rel_description = descfile
- self.configParser = self.__load_description_file(self.rel_description)
-
- # Add a method to the class called after the description file
- methodName = self.rel_description.lower()[
- :-len(".expected")].replace(" ", "_")[-60:]
-
- if (self.__is_expected_failure()):
- setattr(self,
- methodName,
- self.expected_failure_test_extraction)
- else:
- setattr(self,
- methodName,
- self.generic_test_extraction)
-
- # unittest framework will run the test called "self._testMethodName"
- # So we set that variable to our new name
- self._testMethodName = methodName
-
- def runTest(self):
- """
- Empty function pointer, that should NEVER be called. It is required to exist by unittest.
- """
- assert False
-
- def __load_description_file(self, descfile):
- configParser = ConfigParser.RawConfigParser()
- # Make it case sensitive:
- configParser.optionxform = str
- abs_description = os.path.abspath(descfile)
- loaded_files = configParser.read(abs_description)
- if not abs_description in loaded_files:
- raise Exception("Unable to load %s" % (abs_description))
-
- return configParser
-
- def __is_expected_failure(self):
- assert self.configParser
- return self.configParser.has_option("TestFile", "ExpectedFailure")
-
- def __get_bugnumber(self):
- assert self.configParser
- if self.configParser.has_option("TestFile", "Bugzilla"):
- return "'" + self.configParser.get("TestFile", "Bugzilla") + "'"
- else:
- return None
-
- def expected_failure_test_extraction(self):
- try:
- self.generic_test_extraction()
- except Exception:
- raise ut.case._ExpectedFailure(sys.exc_info())
-
- if self.__get_bugnumber():
- raise Exception(
- "Unexpected success. Maybe bug: " + self.__get_bugnumber() + " has been fixed?")
- else:
- raise Exception(
- "Unexpected success. Check " + self.rel_description)
-
- def generic_test_extraction(self):
- abs_description = os.path.abspath(self.rel_description)
-
- # Filename contains the file to extract, in a relative path to the
- # description file
- desc_root, desc_file = os.path.split(abs_description)
-
- filename_to_extract = self.configParser.get("TestFile", "Filename")
- self.file_to_extract = os.path.join(desc_root, filename_to_extract)
-
- result = get_tracker_extract_output(self.file_to_extract)
- self.__assert_extraction_ok(result)
-
- def assertDictHasKey(self, d, key, msg=None):
- if not d.has_key(key):
- standardMsg = "Missing: %s\n" % (key)
- self.fail(self._formatMessage(msg, standardMsg))
- else:
- return
+import os
+import unittest
- def assertIsURN(self, supposed_uuid, msg=None):
- import uuid
+from logging import info
- try:
- if (supposed_uuid.startswith("<") and supposed_uuid.endswith(">")):
- supposed_uuid = supposed_uuid[1:-1]
- uuid.UUID(supposed_uuid)
- except ValueError:
- standardMsg = "'%s' is not a valid UUID" % (supposed_uuid)
- self.fail(self._formatMessage(msg, standardMsg))
+import extractor_testcase
- def __assert_extraction_ok(self, result):
- self.__check_section("Metadata", result)
- if (cfg.haveMaemo and self.configParser.has_section("Meego")):
- self.__check_section("Meego", result)
+def load_tests(loader, standard_tests, pattern):
+ '''Load all extractor test cases defined in data/
- def __check_section(self, section, result):
- error_missing_prop = "Property '%s' hasn't been extracted from file \n'%s'\n (requested on '%s' [%s])"
- error_wrong_value = "on property '%s' from file %s\n (requested on: '%s' [%s])"
- error_extra_prop = "Property '%s' was explicitely banned for file \n'%s'\n (requested on '%s' [%s])"
- error_extra_prop_v = "Property '%s' with value '%s' was explicitely banned for file \n'%s'\n (requested on %s' [%s])"
+ Traverse the TEST_DATA_PATH directory looking for .description files. Add a
+ new TestCase to the suite per .description file and run the suite.
- expected_pairs = [] # List of expected (key, value)
- unexpected_pairs = [] # List of unexpected (key, value)
- expected_keys = []
- # List of expected keys (the key must be there, value doesnt
- # matter)
+ If we do this inside a single TestCase an error in one test would stop the
+ whole testing.
- for k, v in self.configParser.items(section):
- if k.startswith("!"):
- unexpected_pairs.append((k[1:].replace("_", ":"), v))
- elif k.startswith("@"):
- expected_keys.append(k[1:].replace("_", ":"))
- else:
- expected_pairs.append((k.replace("_", ":"), v))
+ '''
- for (prop, value) in expected_pairs:
- self.assertDictHasKey(result, prop,
- error_missing_prop % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
- if value == "@URNUUID@":
- # Watch out! We take only the FIRST element. Incompatible with
- # multiple-valued props.
- self.assertIsURN(result[prop][0],
- error_wrong_value % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
- else:
- self.assertIn(value, result[prop],
- error_wrong_value % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
+ import logging
+ logging.basicConfig()
- for (prop, value) in unexpected_pairs:
- # There is no prop, or it is but not with that value
- if (value == ""):
- self.assertFalse(
- result.has_key(prop), error_extra_prop % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
- else:
- if (value == "@URNUUID@"):
- self.assertIsURN(
- result[prop][0], error_extra_prop % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
- else:
- self.assertNotIn(
- value, result[prop], error_extra_prop_v % (prop,
- value,
- self.file_to_extract,
- self.rel_description,
- section))
+ TEST_DATA_PATH = os.path.join(os.getcwd(), 'extractor', 'data')
- for prop in expected_keys:
- self.assertDictHasKey(result, prop,
- error_missing_prop % (prop,
- self.file_to_extract,
- self.rel_description,
- section))
+ assert os.path.isdir(TEST_DATA_PATH), \
+ "Directory %s doesn't exist" % TEST_DATA_PATH
+ info("Loading test descriptions from %s", TEST_DATA_PATH)
-def run_all():
- #
- # Traverse the TEST_DATA_PATH directory looking for .description files
- # Add a new TestCase to the suite per .description file and run the suite.
- #
- # Is we do this inside a single TestCase an error in one test would stop the whole
- # testing.
- #
- if (os.path.exists(os.getcwd() + "/test-extraction-data")):
- # Use local directory if available
- TEST_DATA_PATH = os.getcwd() + "/test-extraction-data"
- else:
- TEST_DATA_PATH = os.path.join(cfg.DATADIR, "tracker-tests",
- "test-extraction-data")
- print "Loading test descriptions from", TEST_DATA_PATH
- extractionTestSuite = ut.TestSuite()
+ suite = unittest.TestSuite()
+ print TEST_DATA_PATH
for root, dirs, files in os.walk(TEST_DATA_PATH):
descriptions = [os.path.join(root, f)
for f in files if f.endswith("expected")]
for descfile in descriptions:
- tc = ExtractionTestCase(descfile=descfile)
- extractionTestSuite.addTest(tc)
- result = ut.TextTestRunner(verbosity=1).run(extractionTestSuite)
- sys.exit(not result.wasSuccessful())
-
-
-def run_one(filename):
- #
- # Run just one .description file
- #
- description = os.path.join(os.getcwd(), filename)
-
- extractionTestSuite = ut.TestSuite()
- tc = ExtractionTestCase(descfile=description)
- extractionTestSuite.addTest(tc)
-
- result = ut.TextTestRunner(verbosity=2).run(extractionTestSuite)
- sys.exit(not result.wasSuccessful())
-
+ tc = extractor_testcase.ExtractorTestCase(descfile=descfile)
+ suite.addTest(tc)
-if __name__ == "__main__":
- if (len(sys.argv) == 1):
- run_all()
- else:
- if os.path.exists(sys.argv[1]) and sys.argv[1].endswith(".expected"):
- run_one(sys.argv[1])
- # FIXME: for the case when invoked by testrunner (see
- # create-tests-xml.py)
- elif sys.argv[1] == "ExtractionTestCase":
- run_all()
- else:
- print "Usage: %s [FILE.expected]" % (sys.argv[0])
+ return suite
diff --git a/tests/functional-tests/store/__init__.py b/tests/functional-tests/store/__init__.py
index a1766da1d..e1207de99 100644
--- a/tests/functional-tests/store/__init__.py
+++ b/tests/functional-tests/store/__init__.py
@@ -16,6 +16,10 @@
# 02110-1301, USA.
+# Including all tests in this file ensures that they can be run with
+# `python -m unittest module` as well as `python -m unittest discover module`.
+
+
import test_backup_restore
import test_coalesce
import test_collation
diff --git a/tests/functional-tests/store/testcase.py b/tests/functional-tests/store/store_testcase.py
index 395f6856e..395f6856e 100644
--- a/tests/functional-tests/store/testcase.py
+++ b/tests/functional-tests/store/store_testcase.py
diff --git a/tests/functional-tests/store/test_backup_restore.py b/tests/functional-tests/store/test_backup_restore.py
index f35620018..5a48e21f6 100644
--- a/tests/functional-tests/store/test_backup_restore.py
+++ b/tests/functional-tests/store/test_backup_restore.py
@@ -25,7 +25,7 @@ import dbus # For the exception handling
from common.utils import configuration as cfg
from common.utils.expectedFailure import expectedFailureBug, expectedFailureJournal
-import testcase
+import store_testcase
"""
@@ -33,7 +33,7 @@ Call backup, restore, force the journal replay and check the data is correct aft
"""
-class BackupRestoreTest (testcase.TrackerStoreTest):
+class BackupRestoreTest (store_testcase.TrackerStoreTest):
'''Backup and restore to/from valid/invalid files'''
@@ -252,7 +252,7 @@ class BackupRestoreTest (testcase.TrackerStoreTest):
self.__delete_test_instance()
-class JournalReplayTest (testcase.TrackerStoreTest):
+class JournalReplayTest (store_testcase.TrackerStoreTest):
"""
Force journal replaying and check that the DB is correct aftewards
diff --git a/tests/functional-tests/store/test_coalesce.py b/tests/functional-tests/store/test_coalesce.py
index 78f359636..ca30c9723 100644
--- a/tests/functional-tests/store/test_coalesce.py
+++ b/tests/functional-tests/store/test_coalesce.py
@@ -27,10 +27,10 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestCoalesce (testcase.TrackerStoreTest):
+class TestCoalesce (store_testcase.TrackerStoreTest):
"""
Insert and instance with some values, and tracker coalesce of some of them
diff --git a/tests/functional-tests/store/test_collation.py b/tests/functional-tests/store/test_collation.py
index a4af211c7..055be4e5a 100644
--- a/tests/functional-tests/store/test_collation.py
+++ b/tests/functional-tests/store/test_collation.py
@@ -28,10 +28,10 @@ import locale
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TrackerStoreCollationTests (testcase.TrackerStoreTest):
+class TrackerStoreCollationTests (store_testcase.TrackerStoreTest):
"""
Insert few instances with a text field containing collation-problematic words.
diff --git a/tests/functional-tests/store/test_concurrent_query.py b/tests/functional-tests/store/test_concurrent_query.py
index 1f3a379cb..01e888be6 100644
--- a/tests/functional-tests/store/test_concurrent_query.py
+++ b/tests/functional-tests/store/test_concurrent_query.py
@@ -33,13 +33,13 @@ from dbus.mainloop.glib import DBusGMainLoop
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
AMOUNT_OF_TEST_INSTANCES = 100
AMOUNT_OF_QUERIES = 10
-class TestConcurrentQuery (testcase.TrackerStoreTest):
+class TestConcurrentQuery (store_testcase.TrackerStoreTest):
"""
Send a bunch of queries to the daemon asynchronously, to test the queue
diff --git a/tests/functional-tests/store/test_distance.py b/tests/functional-tests/store/test_distance.py
index 047f3d4a7..5c8f08a35 100644
--- a/tests/functional-tests/store/test_distance.py
+++ b/tests/functional-tests/store/test_distance.py
@@ -26,14 +26,14 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
POINT_COORDS = [
(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)
]
-class TestDistanceFunctions (testcase.TrackerStoreTest):
+class TestDistanceFunctions (store_testcase.TrackerStoreTest):
"""
Insert some points and get the distance between them.
diff --git a/tests/functional-tests/store/test_fts_functions.py b/tests/functional-tests/store/test_fts_functions.py
index dbfa95761..52c961b68 100644
--- a/tests/functional-tests/store/test_fts_functions.py
+++ b/tests/functional-tests/store/test_fts_functions.py
@@ -28,10 +28,10 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestFTSFunctions (testcase.TrackerStoreTest):
+class TestFTSFunctions (store_testcase.TrackerStoreTest):
"""
Insert data with text and check the fts:xxxx functions are returning the expected results
diff --git a/tests/functional-tests/store/test_graph.py b/tests/functional-tests/store/test_graph.py
index 53558f2f0..d986f32ba 100644
--- a/tests/functional-tests/store/test_graph.py
+++ b/tests/functional-tests/store/test_graph.py
@@ -26,10 +26,10 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestGraphs (testcase.TrackerStoreTest):
+class TestGraphs (store_testcase.TrackerStoreTest):
"""
Insert triplets in different graphs and check the query results asking in
diff --git a/tests/functional-tests/store/test_group_concat.py b/tests/functional-tests/store/test_group_concat.py
index 7fb88dab4..bf711f359 100644
--- a/tests/functional-tests/store/test_group_concat.py
+++ b/tests/functional-tests/store/test_group_concat.py
@@ -26,10 +26,10 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestGroupConcat (testcase.TrackerStoreTest):
+class TestGroupConcat (store_testcase.TrackerStoreTest):
"""
Insert a multivalued property and request the results in GROUP_CONCAT
diff --git a/tests/functional-tests/store/test_insertion.py b/tests/functional-tests/store/test_insertion.py
index 18ecd6bff..c3eb24bbb 100644
--- a/tests/functional-tests/store/test_insertion.py
+++ b/tests/functional-tests/store/test_insertion.py
@@ -33,10 +33,10 @@ import datetime
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TrackerStoreInsertionTests (testcase.TrackerStoreTest):
+class TrackerStoreInsertionTests (store_testcase.TrackerStoreTest):
"""
Insert single and multiple-valued properties, dates (ok and broken)
@@ -633,7 +633,7 @@ class TrackerStoreInsertionTests (testcase.TrackerStoreTest):
"""DELETE { <test://instance-ds3> a rdfs:Resource. }""")
-class TrackerStoreDeleteTests (testcase.TrackerStoreTest):
+class TrackerStoreDeleteTests (store_testcase.TrackerStoreTest):
"""
Use DELETE in Sparql and check the information is actually removed
@@ -720,7 +720,7 @@ class TrackerStoreDeleteTests (testcase.TrackerStoreTest):
self.assertEquals(after_removal, initial)
-class TrackerStoreBatchUpdateTest (testcase.TrackerStoreTest):
+class TrackerStoreBatchUpdateTest (store_testcase.TrackerStoreTest):
"""
Insert data using the BatchSparqlUpdate method in the store
@@ -791,7 +791,7 @@ class TrackerStoreBatchUpdateTest (testcase.TrackerStoreTest):
self.assertEquals(count_before_insert, count_final)
-class TrackerStorePhoneNumberTest (testcase.TrackerStoreTest):
+class TrackerStorePhoneNumberTest (store_testcase.TrackerStoreTest):
"""
Tests around phone numbers (maemo specific). Inserting correct/incorrect ones
diff --git a/tests/functional-tests/store/test_signals.py b/tests/functional-tests/store/test_signals.py
index 8157116b5..8cac815d2 100644
--- a/tests/functional-tests/store/test_signals.py
+++ b/tests/functional-tests/store/test_signals.py
@@ -24,7 +24,7 @@ are tested)
"""
import unittest as ut
-import testcase
+import store_testcase
from common.utils import configuration as cfg
from gi.repository import GObject
@@ -43,7 +43,7 @@ CONTACT_CLASS_URI = "http://www.semanticdesktop.org/ontologies/2007/03/22/nco#Pe
REASONABLE_TIMEOUT = 10 # Time waiting for the signal to be emitted
-class TrackerStoreSignalsTests (testcase.TrackerStoreTest):
+class TrackerStoreSignalsTests (store_testcase.TrackerStoreTest):
"""
Insert/update/remove instances from nco:PersonContact
diff --git a/tests/functional-tests/store/test_sparql_bugs.py b/tests/functional-tests/store/test_sparql_bugs.py
index 4515feb4c..0d1bd49d0 100644
--- a/tests/functional-tests/store/test_sparql_bugs.py
+++ b/tests/functional-tests/store/test_sparql_bugs.py
@@ -32,11 +32,11 @@ import datetime
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
from common.utils.expectedFailure import expectedFailureBug
-class TrackerStoreSparqlBugsTests (testcase.TrackerStoreTest):
+class TrackerStoreSparqlBugsTests (store_testcase.TrackerStoreTest):
def test_01_NB217566_union_exists_filter(self):
"""
diff --git a/tests/functional-tests/store/test_sqlite_batch_misused.py b/tests/functional-tests/store/test_sqlite_batch_misused.py
index cb7cd4962..65184d5c9 100644
--- a/tests/functional-tests/store/test_sqlite_batch_misused.py
+++ b/tests/functional-tests/store/test_sqlite_batch_misused.py
@@ -28,13 +28,13 @@ from dbus.mainloop.glib import DBusGMainLoop
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
# Number of instances per batch
BATCH_SIZE = 3000
-class TestSqliteBatchMisused (testcase.TrackerStoreTest):
+class TestSqliteBatchMisused (store_testcase.TrackerStoreTest):
"""
Send big batchSparqlUpdates and run queries at the same time
diff --git a/tests/functional-tests/store/test_sqlite_misused.py b/tests/functional-tests/store/test_sqlite_misused.py
index 6087de419..034d32982 100644
--- a/tests/functional-tests/store/test_sqlite_misused.py
+++ b/tests/functional-tests/store/test_sqlite_misused.py
@@ -28,17 +28,17 @@ from dbus.mainloop.glib import DBusGMainLoop
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestSqliteMisused (testcase.TrackerStoreTest):
+class TestSqliteMisused (store_testcase.TrackerStoreTest):
"""
Send queries while importing files (in .ttl directory)
"""
def setUp(self):
- super(testcase.TrackerStoreTest, self).setUp()
+ super(store_testcase.TrackerStoreTest, self).setUp()
self.main_loop = GObject.MainLoop()
self.files_counter = 0
diff --git a/tests/functional-tests/store/test_statistics.py b/tests/functional-tests/store/test_statistics.py
index 1841daaa3..94b009f48 100644
--- a/tests/functional-tests/store/test_statistics.py
+++ b/tests/functional-tests/store/test_statistics.py
@@ -26,14 +26,14 @@ import time
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
RDFS_RESOURCE = "rdfs:Resource"
NIE_IE = "nie:InformationElement"
RDFS_CLASS = "rdfs:Class"
-class TrackerStoreStatisticsTests (testcase.TrackerStoreTest):
+class TrackerStoreStatisticsTests (store_testcase.TrackerStoreTest):
"""
Check initial statistics, add, remove, update content and check results stats
diff --git a/tests/functional-tests/store/test_threaded_store.py b/tests/functional-tests/store/test_threaded_store.py
index b8a03e431..80674c8d2 100644
--- a/tests/functional-tests/store/test_threaded_store.py
+++ b/tests/functional-tests/store/test_threaded_store.py
@@ -30,7 +30,7 @@ from dbus.mainloop.glib import DBusGMainLoop
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
MAX_TEST_TIME = 60 # seconds to finish the tests (to avoid infinite waitings)
@@ -41,7 +41,7 @@ COMPLEX_QUERY_TIMEOUT = 15000
SIMPLE_QUERY_FREQ = 2
-class TestThreadedStore (testcase.TrackerStoreTest):
+class TestThreadedStore (store_testcase.TrackerStoreTest):
"""
When the database is big, running a complex query takes ages.
diff --git a/tests/functional-tests/store/test_transactions.py b/tests/functional-tests/store/test_transactions.py
index d6a3b732b..cc88d1bc3 100644
--- a/tests/functional-tests/store/test_transactions.py
+++ b/tests/functional-tests/store/test_transactions.py
@@ -26,13 +26,13 @@ import time
from common.utils import configuration as cfg
from common.utils.helpers import StoreHelper as StoreHelper
-import testcase
+import store_testcase
TEST_INSTANCE_PATTERN = "test://12-transactions-%d"
-class TrackerTransactionsTest(testcase.TrackerStoreTest):
+class TrackerTransactionsTest(store_testcase.TrackerStoreTest):
"""
In a loop:
diff --git a/tests/functional-tests/store/test_unique_insertions.py b/tests/functional-tests/store/test_unique_insertions.py
index d42237935..8f89d2ca9 100644
--- a/tests/functional-tests/store/test_unique_insertions.py
+++ b/tests/functional-tests/store/test_unique_insertions.py
@@ -26,10 +26,10 @@ import random
from common.utils import configuration as cfg
import unittest as ut
-import testcase
+import store_testcase
-class TestMinerInsertBehaviour (testcase.TrackerStoreTest):
+class TestMinerInsertBehaviour (store_testcase.TrackerStoreTest):
"""
Mimic the behaviour of the miner, removing the previous information of the resource