server/test/unittest_multisources.py
branchstable
changeset 6781 5062d86d6ffe
parent 6758 28b11ecf319b
child 6782 b5d6f5391695
child 7078 bad26a22fe29
equal deleted inserted replaced
6780:92e4c07f86c0 6781:5062d86d6ffe
    44 from cubicweb.dbapi import Connection
    44 from cubicweb.dbapi import Connection
    45 
    45 
    46 PyroRQLSource_get_connection = PyroRQLSource.get_connection
    46 PyroRQLSource_get_connection = PyroRQLSource.get_connection
    47 Connection_close = Connection.close
    47 Connection_close = Connection.close
    48 
    48 
    49 def setup_module(*args):
    49 def setUpModule(*args):
    50     global repo2, cnx2, repo3, cnx3
    50     global repo2, cnx2, repo3, cnx3
    51     cfg1 = ExternalSource1Configuration('data', apphome=TwoSourcesTC.datadir)
    51     cfg1 = ExternalSource1Configuration('data', apphome=TwoSourcesTC.datadir)
    52     repo2, cnx2 = init_test_database(config=cfg1)
    52     repo2, cnx2 = init_test_database(config=cfg1)
    53     cfg2 = ExternalSource2Configuration('data', apphome=TwoSourcesTC.datadir)
    53     cfg2 = ExternalSource2Configuration('data', apphome=TwoSourcesTC.datadir)
    54     repo3, cnx3 = init_test_database(config=cfg2)
    54     repo3, cnx3 = init_test_database(config=cfg2)
    62     PyroRQLSource.get_connection = lambda x: x.uri == 'extern-multi' and cnx3 or cnx2
    62     PyroRQLSource.get_connection = lambda x: x.uri == 'extern-multi' and cnx3 or cnx2
    63     # also necessary since the repository is closing its initial connections
    63     # also necessary since the repository is closing its initial connections
    64     # pool though we want to keep cnx2 valid
    64     # pool though we want to keep cnx2 valid
    65     Connection.close = lambda x: None
    65     Connection.close = lambda x: None
    66 
    66 
    67 def teardown_module(*args):
    67 def tearDownModule(*args):
    68     PyroRQLSource.get_connection = PyroRQLSource_get_connection
    68     PyroRQLSource.get_connection = PyroRQLSource_get_connection
    69     Connection.close = Connection_close
    69     Connection.close = Connection_close
    70     global repo2, cnx2, repo3, cnx3
    70     global repo2, cnx2, repo3, cnx3
    71     repo2.shutdown()
    71     repo2.shutdown()
    72     repo3.shutdown()
    72     repo3.shutdown()