[tracker/sam/ft-python2.7] functional-tests: Remove bundled unittest2 library



commit f31e5d83e42fd0da124c281f09c5af5a54d2b7c6
Author: Sam Thursfield <sam afuera me uk>
Date:   Sat Jan 5 16:02:16 2019 +0100

    functional-tests: Remove bundled unittest2 library
    
    This removes support for running the tests with Python 2.6 and older.

 tests/functional-tests/01-insertion.py             |    2 +-
 tests/functional-tests/02-sparql-bugs.py           |    3 +-
 tests/functional-tests/03-fts-functions.py         |    2 +-
 tests/functional-tests/04-group-concat.py          |    2 +-
 tests/functional-tests/05-coalesce.py              |    2 +-
 tests/functional-tests/06-distance.py              |    2 +-
 tests/functional-tests/07-graph.py                 |    2 +-
 tests/functional-tests/08-unique-insertions.py     |    2 +-
 tests/functional-tests/09-concurrent-query.py      |    2 +-
 tests/functional-tests/10-sqlite-misused.py        |    2 +-
 tests/functional-tests/11-sqlite-batch-misused.py  |    2 +-
 tests/functional-tests/12-transactions.py          |    2 +-
 tests/functional-tests/13-threaded-store.py        |    2 +-
 tests/functional-tests/14-signals.py               |    2 +-
 tests/functional-tests/15-statistics.py            |    2 +-
 tests/functional-tests/16-collation.py             |    2 +-
 tests/functional-tests/17-ontology-changes.py      |    2 +-
 .../common/utils/expectedFailure.py                |   21 +-
 tests/functional-tests/common/utils/storetest.py   |    2 +-
 tests/functional-tests/unittest2/__init__.py       |   72 --
 tests/functional-tests/unittest2/__main__.py       |   14 -
 tests/functional-tests/unittest2/case.py           | 1058 --------------------
 tests/functional-tests/unittest2/compatibility.py  |   68 --
 tests/functional-tests/unittest2/loader.py         |  318 ------
 tests/functional-tests/unittest2/main.py           |  236 -----
 tests/functional-tests/unittest2/result.py         |  185 ----
 tests/functional-tests/unittest2/runner.py         |  208 ----
 tests/functional-tests/unittest2/signals.py        |   59 --
 tests/functional-tests/unittest2/suite.py          |  264 -----
 tests/functional-tests/unittest2/unit2             |    8 -
 tests/functional-tests/unittest2/unit2.py          |    8 -
 tests/functional-tests/unittest2/util.py           |   94 --
 32 files changed, 19 insertions(+), 2631 deletions(-)
---
diff --git a/tests/functional-tests/01-insertion.py b/tests/functional-tests/01-insertion.py
index dba85a4b2..3cff38d2c 100755
--- a/tests/functional-tests/01-insertion.py
+++ b/tests/functional-tests/01-insertion.py
@@ -30,7 +30,7 @@ import string
 import datetime
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/02-sparql-bugs.py b/tests/functional-tests/02-sparql-bugs.py
index f4f541e11..f7407732a 100755
--- a/tests/functional-tests/02-sparql-bugs.py
+++ b/tests/functional-tests/02-sparql-bugs.py
@@ -32,10 +32,9 @@ import string
 import datetime
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
-from common.utils.expectedFailure import expectedFailureBug
 
 
 class TrackerStoreSparqlBugsTests (CommonTrackerStoreTest):
diff --git a/tests/functional-tests/03-fts-functions.py b/tests/functional-tests/03-fts-functions.py
index 2add4bc58..fcbf27032 100755
--- a/tests/functional-tests/03-fts-functions.py
+++ b/tests/functional-tests/03-fts-functions.py
@@ -26,7 +26,7 @@ import unittest
 import random
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/04-group-concat.py b/tests/functional-tests/04-group-concat.py
index 5d9bcd116..83d155bf9 100755
--- a/tests/functional-tests/04-group-concat.py
+++ b/tests/functional-tests/04-group-concat.py
@@ -24,7 +24,7 @@ import unittest
 import random
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/05-coalesce.py b/tests/functional-tests/05-coalesce.py
index 6463cbd70..af6fd888d 100755
--- a/tests/functional-tests/05-coalesce.py
+++ b/tests/functional-tests/05-coalesce.py
@@ -25,7 +25,7 @@ import random
 
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/06-distance.py b/tests/functional-tests/06-distance.py
index 04239fbb6..3f9be0d7e 100755
--- a/tests/functional-tests/06-distance.py
+++ b/tests/functional-tests/06-distance.py
@@ -24,7 +24,7 @@ import unittest
 import random
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/07-graph.py b/tests/functional-tests/07-graph.py
index 3999977f5..455bde220 100755
--- a/tests/functional-tests/07-graph.py
+++ b/tests/functional-tests/07-graph.py
@@ -24,7 +24,7 @@ import unittest
 import random
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/08-unique-insertions.py b/tests/functional-tests/08-unique-insertions.py
index 04909a476..5959517af 100755
--- a/tests/functional-tests/08-unique-insertions.py
+++ b/tests/functional-tests/08-unique-insertions.py
@@ -24,7 +24,7 @@ import unittest
 import random
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/09-concurrent-query.py b/tests/functional-tests/09-concurrent-query.py
index 7f982afec..520029a20 100755
--- a/tests/functional-tests/09-concurrent-query.py
+++ b/tests/functional-tests/09-concurrent-query.py
@@ -29,7 +29,7 @@ import signal
 from gi.repository import GObject
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/10-sqlite-misused.py b/tests/functional-tests/10-sqlite-misused.py
index 0b7dc9d60..5ba0ff555 100755
--- a/tests/functional-tests/10-sqlite-misused.py
+++ b/tests/functional-tests/10-sqlite-misused.py
@@ -25,7 +25,7 @@ import os
 from gi.repository import GObject
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/11-sqlite-batch-misused.py 
b/tests/functional-tests/11-sqlite-batch-misused.py
index cc810f2c8..ad730eb49 100755
--- a/tests/functional-tests/11-sqlite-batch-misused.py
+++ b/tests/functional-tests/11-sqlite-batch-misused.py
@@ -25,7 +25,7 @@ import os
 from gi.repository import GObject
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/12-transactions.py b/tests/functional-tests/12-transactions.py
index b461d97a2..d57c257fc 100755
--- a/tests/functional-tests/12-transactions.py
+++ b/tests/functional-tests/12-transactions.py
@@ -24,7 +24,7 @@ import time
 
 from common.utils import configuration as cfg
 from common.utils.helpers import StoreHelper as StoreHelper
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/13-threaded-store.py b/tests/functional-tests/13-threaded-store.py
index f84c88f15..fbeec8ebc 100755
--- a/tests/functional-tests/13-threaded-store.py
+++ b/tests/functional-tests/13-threaded-store.py
@@ -27,7 +27,7 @@ from gi.repository import GLib
 import time
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/14-signals.py b/tests/functional-tests/14-signals.py
index 6524f7b72..8213c16b6 100755
--- a/tests/functional-tests/14-signals.py
+++ b/tests/functional-tests/14-signals.py
@@ -23,7 +23,7 @@ are emitted. Theses tests are not extensive (only few selected signals
 are tested)
 """
 
-import unittest2 as ut
+import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 from common.utils import configuration as cfg
 
diff --git a/tests/functional-tests/15-statistics.py b/tests/functional-tests/15-statistics.py
index 89efc3d77..33c63046e 100755
--- a/tests/functional-tests/15-statistics.py
+++ b/tests/functional-tests/15-statistics.py
@@ -25,7 +25,7 @@ are updated when different operations are executed on the store
 import time
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/16-collation.py b/tests/functional-tests/16-collation.py
index 1d2dff261..2b1e95235 100755
--- a/tests/functional-tests/16-collation.py
+++ b/tests/functional-tests/16-collation.py
@@ -27,7 +27,7 @@ import random
 import locale
 
 from common.utils import configuration as cfg
-import unittest2 as ut
+import unittest as ut
 #import unittest as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 
diff --git a/tests/functional-tests/17-ontology-changes.py b/tests/functional-tests/17-ontology-changes.py
index fcfe0074b..8fbeca188 100755
--- a/tests/functional-tests/17-ontology-changes.py
+++ b/tests/functional-tests/17-ontology-changes.py
@@ -34,7 +34,7 @@ from common.utils import configuration as cfg
 from common.utils import helpers
 from common.utils.dconf import DConfClient
 from common.utils.expectedFailure import expectedFailureJournal
-import unittest2 as ut
+import unittest as ut
 
 
 
diff --git a/tests/functional-tests/common/utils/expectedFailure.py 
b/tests/functional-tests/common/utils/expectedFailure.py
index a496ee21d..8ca7fe330 100644
--- a/tests/functional-tests/common/utils/expectedFailure.py
+++ b/tests/functional-tests/common/utils/expectedFailure.py
@@ -26,28 +26,9 @@ Write values in tracker and check the actual values are written
 on the files. Note that these tests are highly platform dependant.
 """
 import sys
-import unittest2 as ut
-from unittest2.compatibility import wraps
+from functools import wraps
 import configuration as cfg
 
-def expectedFailureBug(bugnumber):
-    """
-    Decorator to mark bugs with ExpectedFailure. In case that a expected failure PASS
-    it will raise an exception pointing to the Bug number.
-
-    Keep your bugs and tests in sync!
-    """
-    def decorator (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 of bug " +str(bugnumber))
-        return wrapper
-    return decorator
-
 def expectedFailureJournal():
     """
     Decorator to handle tests that are expected to fail when journal is disabled.
diff --git a/tests/functional-tests/common/utils/storetest.py 
b/tests/functional-tests/common/utils/storetest.py
index 3a5da0372..febd49529 100644
--- a/tests/functional-tests/common/utils/storetest.py
+++ b/tests/functional-tests/common/utils/storetest.py
@@ -19,7 +19,7 @@
 # 02110-1301, USA.
 #
 
-import unittest2 as ut
+import unittest as ut
 
 import os
 import time


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