server/test/unittest_msplanner.py
branchstable
changeset 7189 0c2c41fcb89d
parent 7188 b2c45b7396fb
child 7306 a21bafe9fe35
equal deleted inserted replaced
7188:b2c45b7396fb 7189:0c2c41fcb89d
    21 
    21 
    22 from logilab.common.decorators import clear_cache
    22 from logilab.common.decorators import clear_cache
    23 from yams.buildobjs import RelationDefinition
    23 from yams.buildobjs import RelationDefinition
    24 from rql import BadRQLQuery
    24 from rql import BadRQLQuery
    25 
    25 
    26 from cubicweb.devtools import init_test_database
    26 from cubicweb.devtools import get_test_db_handler, TestServerConfiguration
    27 from cubicweb.devtools.repotest import BasePlannerTC, test_plan
    27 from cubicweb.devtools.repotest import BasePlannerTC, test_plan
    28 
    28 
    29 class _SetGenerator(object):
    29 class _SetGenerator(object):
    30     """singleton to easily create set using "s[0]" or "s[0,1,2]" for instance
    30     """singleton to easily create set using "s[0]" or "s[0,1,2]" for instance
    31     """
    31     """
    80 
    80 
    81 
    81 
    82 # keep cnx so it's not garbage collected and the associated session is closed
    82 # keep cnx so it's not garbage collected and the associated session is closed
    83 def setUpModule(*args):
    83 def setUpModule(*args):
    84     global repo, cnx
    84     global repo, cnx
    85     repo, cnx = init_test_database(apphome=BaseMSPlannerTC.datadir)
    85     handler = get_test_db_handler(TestServerConfiguration(apphome=BaseMSPlannerTC.datadir))
       
    86     handler.build_db_cache()
       
    87     repo, cnx = handler.get_repo_and_cnx()
    86 
    88 
    87 def tearDownModule(*args):
    89 def tearDownModule(*args):
    88     global repo, cnx
    90     global repo, cnx
    89     del repo, cnx
    91     del repo, cnx
    90 
    92