[test] more cwd independant tests
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 25 Oct 2010 17:54:00 +0200
changeset 6640 4c4616c02f69
parent 6639 90ae7eb3460f
child 6641 ce8e46fca865
[test] more cwd independant tests
test/unittest_rqlrewrite.py
test/unittest_schema.py
--- a/test/unittest_rqlrewrite.py	Mon Oct 25 17:53:42 2010 +0200
+++ b/test/unittest_rqlrewrite.py	Mon Oct 25 17:54:00 2010 +0200
@@ -26,20 +26,23 @@
 from cubicweb.rqlrewrite import RQLRewriter
 from cubicweb.devtools import repotest, TestServerConfiguration
 
-config = TestServerConfiguration('data/rewrite')
-config.bootstrap_cubes()
-schema = config.load_schema()
-from yams.buildobjs import RelationDefinition
-schema.add_relation_def(RelationDefinition(subject='Card', name='in_state', object='State', cardinality='1*'))
-
-rqlhelper = RQLHelper(schema, special_relations={'eid': 'uid',
-                                                 'has_text': 'fti'})
 
 def setup_module(*args):
+    global rqlhelper, schema
+    config = TestServerConfiguration(RQLRewriteTC.datapath('rewrite'))
+    config.bootstrap_cubes()
+    schema = config.load_schema()
+    from yams.buildobjs import RelationDefinition
+    schema.add_relation_def(RelationDefinition(subject='Card', name='in_state', object='State', cardinality='1*'))
+
+    rqlhelper = RQLHelper(schema, special_relations={'eid': 'uid',
+                                                     'has_text': 'fti'})
     repotest.do_monkey_patch()
 
 def teardown_module(*args):
     repotest.undo_monkey_patch()
+    global rqlhelper, schema
+    del rqlhelper, schema
 
 def eid_func_map(eid):
     return {1: 'CWUser',
--- a/test/unittest_schema.py	Mon Oct 25 17:53:42 2010 +0200
+++ b/test/unittest_schema.py	Mon Oct 25 17:54:00 2010 +0200
@@ -151,7 +151,7 @@
         self.assertEqual(str(expr), 'Any O,U WHERE U has_update_permission O, O eid %(o)s, U eid %(u)s')
 
 loader = CubicWebSchemaLoader()
-config = TestConfiguration('data')
+config = TestConfiguration('data', apphome=DATADIR)
 config.bootstrap_cubes()
 
 class SchemaReaderClassTest(TestCase):