[tracker/checkpoint: 12/16] functional-tests: Handle DISABLE_JOURNAL in ontology-changes tests
- From: JÃrg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/checkpoint: 12/16] functional-tests: Handle DISABLE_JOURNAL in ontology-changes tests
- Date: Tue, 28 Jun 2011 09:36:54 +0000 (UTC)
commit 2434d6ce994fe0b967300404d879becdcfc1e299
Author: JÃrg Billeter <j bitron ch>
Date: Fri Jun 24 14:25:03 2011 +0200
functional-tests: Handle DISABLE_JOURNAL in ontology-changes tests
configure.ac | 2 ++
tests/functional-tests/17-ontology-changes.py | 10 +++++++++-
.../common/utils/configuration.py.in | 1 +
.../common/utils/expectedFailure.py | 20 ++++++++++++++++++++
4 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d162fd7..1b17db2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -625,6 +625,8 @@ AC_ARG_ENABLE(journal,
[enable_journal="$enableval"],
[enable_journal=yes])
+AM_CONDITIONAL(DISABLE_JOURNAL, test "x$enable_journal" = "xno")
+
if test "x$enable_journal" = "xno" ; then
AC_DEFINE(DISABLE_JOURNAL, 1, [Define if we disable the journal])
fi
diff --git a/tests/functional-tests/17-ontology-changes.py b/tests/functional-tests/17-ontology-changes.py
index e15cbb6..890a397 100755
--- a/tests/functional-tests/17-ontology-changes.py
+++ b/tests/functional-tests/17-ontology-changes.py
@@ -32,7 +32,7 @@ import unittest2 as ut
from common.utils.system import TrackerSystemAbstraction as TrackerSystemAbstraction
from common.utils.system import UnableToBootException as UnableToBootException
from common.utils.helpers import StoreHelper as StoreHelper
-from common.utils.expectedFailure import expectedFailureBug
+from common.utils.expectedFailure import expectedFailureBug, expectedFailureJournal
RDFS_RANGE = "http://www.w3.org/2000/01/rdf-schema#range"
@@ -175,6 +175,7 @@ class PropertyRangeStringToDate (OntologyChangeTestTemplate):
Change the range of a property from string to date. There shouldn't be any data loss.
"""
+ @expectedFailureJournal()
def test_property_range_string_to_date (self):
self.template_test_ontology_change ()
@@ -203,6 +204,7 @@ class PropertyRangeDateToString (OntologyChangeTestTemplate):
Change the range of a property from date to string. There shouldn't be any data loss.
"""
+ @expectedFailureJournal()
def test_property_range_date_to_string (self):
self.template_test_ontology_change ()
@@ -276,6 +278,7 @@ class PropertyMaxCardinality1toN (OntologyChangeTestTemplate):
Change cardinality of a property from 1 to N. There shouldn't be any data loss
"""
+ @expectedFailureJournal()
def test_property_cardinality_1_to_n (self):
self.template_test_ontology_change ()
@@ -307,6 +310,7 @@ class PropertyMaxCardinalityNto1 (OntologyChangeTestTemplate):
Change the cardinality of a property for N to 1.
"""
+ @expectedFailureJournal()
def test_property_cardinality_n_to_1 (self):
self.template_test_ontology_change ()
@@ -689,6 +693,7 @@ class SuperclassRemovalTest (OntologyChangeTestTemplate):
"""
Remove the superclass relation between two classes
"""
+ @expectedFailureJournal()
def test_superclass_removal (self):
self.template_test_ontology_change ()
@@ -730,6 +735,7 @@ class SuperclassAdditionTest (OntologyChangeTestTemplate):
"""
Add a superclass to a class with no superclass previously
"""
+ @expectedFailureJournal()
def test_superclass_addition (self):
self.template_test_ontology_change ()
@@ -772,6 +778,7 @@ class PropertyPromotionTest (OntologyChangeTestTemplate):
"""
Move a property to the superclass
"""
+ @expectedFailureJournal()
def test_property_promotion (self):
self.template_test_ontology_change ()
@@ -806,6 +813,7 @@ class PropertyRelegationTest (OntologyChangeTestTemplate):
"""
Move a property to the subclass
"""
+ @expectedFailureJournal()
def test_property_relegation (self):
self.template_test_ontology_change ()
diff --git a/tests/functional-tests/common/utils/configuration.py.in b/tests/functional-tests/common/utils/configuration.py.in
index 799457d..f27843e 100644
--- a/tests/functional-tests/common/utils/configuration.py.in
+++ b/tests/functional-tests/common/utils/configuration.py.in
@@ -77,6 +77,7 @@ BINDIR = os.path.normpath (expandvars (RAW_BINDIR))
haveMaemo = ("@HAVE_MAEMO_TRUE@" == "")
haveUpstart = ("@HAVE_UPSTART_TRUE@" == "")
+disableJournal = ("@DISABLE_JOURNAL_TRUE@" == "")
TEST_TMP_DIR = os.path.join (os.environ["HOME"], ".tracker-tests")
diff --git a/tests/functional-tests/common/utils/expectedFailure.py b/tests/functional-tests/common/utils/expectedFailure.py
index f8ced47..a496ee2 100644
--- a/tests/functional-tests/common/utils/expectedFailure.py
+++ b/tests/functional-tests/common/utils/expectedFailure.py
@@ -28,6 +28,7 @@ on the files. Note that these tests are highly platform dependant.
import sys
import unittest2 as ut
from unittest2.compatibility import wraps
+import configuration as cfg
def expectedFailureBug(bugnumber):
"""
@@ -46,3 +47,22 @@ def expectedFailureBug(bugnumber):
raise Exception ("Unexpected success. This should fail because of bug " +str(bugnumber))
return wrapper
return decorator
+
+def expectedFailureJournal():
+ """
+ Decorator to handle tests that are expected to fail when journal is disabled.
+ """
+ def decorator (func):
+ # no wrapping if journal is enabled, test is expected to pass
+ if not cfg.disableJournal:
+ return func
+
+ @wraps(func)
+ def wrapper(*args, **kwargs):
+ try:
+ func(*args, **kwargs)
+ except Exception:
+ raise ut.case._ExpectedFailure(sys.exc_info())
+ raise Exception ("Unexpected success. This should fail because journal is disabled")
+ return wrapper
+ return decorator
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]