[test] use setUpClass rather than setUpModule to avoid inter-dependency pb with CubicWebTC sub-classes stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 10 Apr 2012 16:59:27 +0200
branchstable
changeset 8347 d317a2880059
parent 8346 97fd81357d1d
child 8348 1a88d201675c
[test] use setUpClass rather than setUpModule to avoid inter-dependency pb with CubicWebTC sub-classes
server/test/unittest_querier.py
--- a/server/test/unittest_querier.py	Tue Apr 10 14:29:42 2012 +0200
+++ b/server/test/unittest_querier.py	Tue Apr 10 16:59:27 2012 +0200
@@ -72,14 +72,15 @@
                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
 
 
-def setUpModule(*args):
+def setUpClass(cls, *args):
     global repo, cnx
     config = TestServerConfiguration(apphome=UtilsTC.datadir)
     handler = get_test_db_handler(config)
     handler.build_db_cache()
     repo, cnx = handler.get_repo_and_cnx()
+    cls.repo = repo
 
-def tearDownModule(*args):
+def tearDownClass(cls, *args):
     global repo, cnx
     cnx.close()
     repo.shutdown()
@@ -87,9 +88,8 @@
 
 
 class UtilsTC(BaseQuerierTC):
-    def setUp(self):
-        self.__class__.repo = repo
-        super(UtilsTC, self).setUp()
+    setUpClass = classmethod(setUpClass)
+    tearDownClass = classmethod(tearDownClass)
 
     def get_max_eid(self):
         # no need for cleanup here
@@ -243,9 +243,8 @@
 
 
 class QuerierTC(BaseQuerierTC):
-    def setUp(self):
-        self.__class__.repo = repo
-        super(QuerierTC, self).setUp()
+    setUpClass = classmethod(setUpClass)
+    tearDownClass = classmethod(tearDownClass)
 
     def test_encoding_pb(self):
         self.assertRaises(RQLSyntaxError, self.execute,