[unittest2] use unittest2 module fixture api stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Wed, 05 Jan 2011 15:32:56 +0100
branchstable
changeset 6781 5062d86d6ffe
parent 6780 92e4c07f86c0
child 6782 b5d6f5391695
child 6784 562dd184cbc7
[unittest2] use unittest2 module fixture api
hooks/test/unittest_syncschema.py
server/test/unittest_hook.py
server/test/unittest_ldapuser.py
server/test/unittest_migractions.py
server/test/unittest_msplanner.py
server/test/unittest_multisources.py
server/test/unittest_querier.py
server/test/unittest_rql2sql.py
server/test/unittest_rqlannotation.py
server/test/unittest_schemaserial.py
server/test/unittest_ssplanner.py
skeleton/test/realdb_test_CUBENAME.py
test/unittest_rqlrewrite.py
web/test/unittest_formfields.py
web/test/unittest_formwidgets.py
--- a/hooks/test/unittest_syncschema.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/hooks/test/unittest_syncschema.py	Wed Jan 05 15:32:56 2011 +0100
@@ -24,7 +24,7 @@
 from cubicweb.server.sqlutils import SQL_PREFIX
 from cubicweb.devtools.repotest import schema_eids_idx, restore_schema_eids_idx
 
-def teardown_module(*args):
+def tearDownModule(*args):
     del SchemaModificationHooksTC.schema_eids
 
 class SchemaModificationHooksTC(CubicWebTC):
--- a/server/test/unittest_hook.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_hook.py	Wed Jan 05 15:32:56 2011 +0100
@@ -79,7 +79,7 @@
 config.bootstrap_cubes()
 schema = config.load_schema()
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global config, schema
     del config, schema
 
--- a/server/test/unittest_ldapuser.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_ldapuser.py	Wed Jan 05 15:32:56 2011 +0100
@@ -70,13 +70,13 @@
     # don't check upassword !
     return self.extid2eid(user['dn'], 'CWUser', session)
 
-def setup_module(*args):
+def setUpModule(*args):
     global repo
     LDAPUserSourceTC._init_repo()
     repo = LDAPUserSourceTC.repo
     add_ldap_source(LDAPUserSourceTC.cnx)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global repo
     repo.shutdown()
     del repo
--- a/server/test/unittest_migractions.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_migractions.py	Wed Jan 05 15:32:56 2011 +0100
@@ -34,7 +34,7 @@
 from cubicweb.server.migractions import *
 
 migrschema = None
-def teardown_module(*args):
+def tearDownModule(*args):
     global migrschema
     del migrschema
     del MigrationCommandsTC.origschema
--- a/server/test/unittest_msplanner.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_msplanner.py	Wed Jan 05 15:32:56 2011 +0100
@@ -76,11 +76,11 @@
 
 
 # keep cnx so it's not garbage collected and the associated session is closed
-def setup_module(*args):
+def setUpModule(*args):
     global repo, cnx
     repo, cnx = init_test_database(apphome=BaseMSPlannerTC.datadir)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global repo, cnx
     del repo, cnx
 
--- a/server/test/unittest_multisources.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_multisources.py	Wed Jan 05 15:32:56 2011 +0100
@@ -46,7 +46,7 @@
 PyroRQLSource_get_connection = PyroRQLSource.get_connection
 Connection_close = Connection.close
 
-def setup_module(*args):
+def setUpModule(*args):
     global repo2, cnx2, repo3, cnx3
     cfg1 = ExternalSource1Configuration('data', apphome=TwoSourcesTC.datadir)
     repo2, cnx2 = init_test_database(config=cfg1)
@@ -64,7 +64,7 @@
     # pool though we want to keep cnx2 valid
     Connection.close = lambda x: None
 
-def teardown_module(*args):
+def tearDownModule(*args):
     PyroRQLSource.get_connection = PyroRQLSource_get_connection
     Connection.close = Connection_close
     global repo2, cnx2, repo3, cnx3
--- a/server/test/unittest_querier.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_querier.py	Wed Jan 05 15:32:56 2011 +0100
@@ -62,11 +62,11 @@
                           ('C0 text,C1 integer', {'A': 'table0.C0', 'B': 'table0.C1'}))
 
 
-def setup_module(*args):
+def setUpModule(*args):
     global repo, cnx
     repo, cnx = init_test_database(apphome=UtilsTC.datadir)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global repo, cnx
     cnx.close()
     repo.shutdown()
--- a/server/test/unittest_rql2sql.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_rql2sql.py	Wed Jan 05 15:32:56 2011 +0100
@@ -38,7 +38,7 @@
     pass # already registered
 
 
-def setup_module(*args):
+def setUpModule():
     global config, schema
     config = TestServerConfiguration('data', apphome=CWRQLTC.datadir)
     config.bootstrap_cubes()
@@ -47,7 +47,7 @@
     schema['state_of'].inlined = False
     schema['comments'].inlined = False
 
-def teardown_module(*args):
+def tearDownModule():
     global config, schema
     del config, schema
 
--- a/server/test/unittest_rqlannotation.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_rqlannotation.py	Wed Jan 05 15:32:56 2011 +0100
@@ -22,11 +22,11 @@
 from cubicweb.devtools.repotest import BaseQuerierTC
 
 
-def setup_module(*args):
+def setUpModule(*args):
     global repo, cnx
     repo, cnx = init_test_database(apphome=SQLGenAnnotatorTC.datadir)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global repo, cnx
     del repo, cnx
 
--- a/server/test/unittest_schemaserial.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_schemaserial.py	Wed Jan 05 15:32:56 2011 +0100
@@ -25,14 +25,14 @@
 from cubicweb.schema import CubicWebSchemaLoader
 from cubicweb.devtools import TestServerConfiguration
 
-def setup_module(*args):
+def setUpModule(*args):
     global schema, config
     loader = CubicWebSchemaLoader()
     config = TestServerConfiguration('data', apphome=Schema2RQLTC.datadir)
     config.bootstrap_cubes()
     schema = loader.load(config)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global schema, config
     del schema, config
 
--- a/server/test/unittest_ssplanner.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/server/test/unittest_ssplanner.py	Wed Jan 05 15:32:56 2011 +0100
@@ -21,11 +21,11 @@
 from cubicweb.server.ssplanner import SSPlanner
 
 # keep cnx so it's not garbage collected and the associated session closed
-def setup_module(*args):
+def setUpModule(*args):
     global repo, cnx
     repo, cnx = init_test_database(apphome=SSPlannerTC.datadir)
 
-def teardown_module(*args):
+def tearDownModule(*args):
     global repo, cnx
     del repo, cnx
 
--- a/skeleton/test/realdb_test_CUBENAME.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/skeleton/test/realdb_test_CUBENAME.py	Wed Jan 05 15:32:56 2011 +0100
@@ -21,7 +21,7 @@
 from cubicweb.devtools import buildconfig, loadconfig
 from cubicweb.devtools.testlib import RealDBTest
 
-def setup_module(options):
+def setUpModule(options):
     if options.source:
         configcls = loadconfig(options.source)
     elif options.dbname is None:
@@ -33,7 +33,7 @@
     RealDatabaseTC.configcls = configcls
 
 class RealDatabaseTC(RealDBTest):
-    configcls = None # set by setup_module()
+    configcls = None # set by setUpModule()
 
     def test_all_primaries(self):
         for rset in self.iter_individual_rsets(limit=50):
--- a/test/unittest_rqlrewrite.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/test/unittest_rqlrewrite.py	Wed Jan 05 15:32:56 2011 +0100
@@ -27,7 +27,7 @@
 from cubicweb.devtools import repotest, TestServerConfiguration
 
 
-def setup_module(*args):
+def setUpModule(*args):
     global rqlhelper, schema
     config = TestServerConfiguration(RQLRewriteTC.datapath('rewrite'))
     config.bootstrap_cubes()
@@ -39,7 +39,7 @@
                                                      'has_text': 'fti'})
     repotest.do_monkey_patch()
 
-def teardown_module(*args):
+def tearDownModule(*args):
     repotest.undo_monkey_patch()
     global rqlhelper, schema
     del rqlhelper, schema
--- a/web/test/unittest_formfields.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/web/test/unittest_formfields.py	Wed Jan 05 15:32:56 2011 +0100
@@ -29,7 +29,7 @@
 
 from cubes.file.entities import File
 
-def setup_module(*args):
+def setUpModule(*args):
     global schema
     config = TestServerConfiguration('data', apphome=GuessFieldTC.datadir)
     config.bootstrap_cubes()
--- a/web/test/unittest_formwidgets.py	Wed Jan 05 15:32:22 2011 +0100
+++ b/web/test/unittest_formwidgets.py	Wed Jan 05 15:32:56 2011 +0100
@@ -24,7 +24,7 @@
 
 from cubes.file.entities import File
 
-def setup_module(*args):
+def setUpModule(*args):
     global schema
     config = TestServerConfiguration('data', apphome=WidgetsTC.datadir)
     config.bootstrap_cubes()