[server/test] raise SkipTest from setUpModule instead of setUp( unittest2 behaviour) + kill some deprecation warnings stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Wed, 05 Jan 2011 15:32:22 +0100
branchstable
changeset 6780 92e4c07f86c0
parent 6779 accf5978a440
child 6781 5062d86d6ffe
[server/test] raise SkipTest from setUpModule instead of setUp( unittest2 behaviour) + kill some deprecation warnings
server/test/unittest_fti.py
--- a/server/test/unittest_fti.py	Wed Jan 05 17:47:16 2011 +0100
+++ b/server/test/unittest_fti.py	Wed Jan 05 15:32:22 2011 +0100
@@ -7,13 +7,18 @@
 from cubicweb.selectors import is_instance
 from cubicweb.entities.adapters import IFTIndexableAdapter
 
+AT_LOGILAB = socket.gethostname().endswith('.logilab.fr')
+
+from logilab.common.testlib import SkipTest
+
+
 class PostgresFTITC(CubicWebTC):
     config = ApptestConfiguration('data', sourcefile='sources_fti')
 
-    def setUp(self):
-        if not socket.gethostname().endswith('.logilab.fr'):
-            self.skipTest('XXX require logilab configuration')
-        super(PostgresFTITC, self).setUp()
+    @classmethod
+    def setUpClass(cls):
+        if not AT_LOGILAB:
+            raise SkipTest('XXX %s: require logilab configuration' % cls.__name__)
 
     def test_occurence_count(self):
         req = self.request()
@@ -44,7 +49,6 @@
             self.assertEqual(req.execute('Card X ORDERBY FTIRANK(X) DESC WHERE X has_text "cubicweb"').rows,
                               [[c3.eid], [c1.eid], [c2.eid]])
 
-
     def test_entity_weight(self):
         class PersonneIFTIndexableAdapter(IFTIndexableAdapter):
             __select__ = is_instance('Personne')
@@ -58,6 +62,7 @@
             self.assertEqual(req.execute('Any X ORDERBY FTIRANK(X) DESC WHERE X has_text "cubicweb"').rows,
                               [[c1.eid], [c3.eid], [c2.eid]])
 
+
 if __name__ == '__main__':
     from logilab.common.testlib import unittest_main
     unittest_main()