server/test/unittest_multisources.py
changeset 5655 ef903fff826d
parent 5590 a56eb02f9ce7
parent 5648 d6bee21cf5db
child 5768 1e73a466aa69
equal deleted inserted replaced
5654:8bb34548be86 5655:ef903fff826d
    22 
    22 
    23 from cubicweb.devtools import TestServerConfiguration, init_test_database
    23 from cubicweb.devtools import TestServerConfiguration, init_test_database
    24 from cubicweb.devtools.testlib import CubicWebTC, refresh_repo
    24 from cubicweb.devtools.testlib import CubicWebTC, refresh_repo
    25 from cubicweb.devtools.repotest import do_monkey_patch, undo_monkey_patch
    25 from cubicweb.devtools.repotest import do_monkey_patch, undo_monkey_patch
    26 
    26 
    27 TestServerConfiguration.no_sqlite_wrap = True
       
    28 
    27 
    29 class TwoSourcesConfiguration(TestServerConfiguration):
    28 class TwoSourcesConfiguration(TestServerConfiguration):
    30     sourcefile = 'sources_multi'
    29     sourcefile = 'sources_multi'
    31 
    30 
    32 
    31 
    46 
    45 
    47 PyroRQLSource_get_connection = PyroRQLSource.get_connection
    46 PyroRQLSource_get_connection = PyroRQLSource.get_connection
    48 Connection_close = Connection.close
    47 Connection_close = Connection.close
    49 
    48 
    50 def setup_module(*args):
    49 def setup_module(*args):
       
    50     TestServerConfiguration.no_sqlite_wrap = True
    51     # hi-jack PyroRQLSource.get_connection to access existing connection (no
    51     # hi-jack PyroRQLSource.get_connection to access existing connection (no
    52     # pyro connection)
    52     # pyro connection)
    53     PyroRQLSource.get_connection = lambda x: x.uri == 'extern-multi' and cnx3 or cnx2
    53     PyroRQLSource.get_connection = lambda x: x.uri == 'extern-multi' and cnx3 or cnx2
    54     # also necessary since the repository is closing its initial connections
    54     # also necessary since the repository is closing its initial connections
    55     # pool though we want to keep cnx2 valid
    55     # pool though we want to keep cnx2 valid
    62     repo2.shutdown()
    62     repo2.shutdown()
    63     repo3.shutdown()
    63     repo3.shutdown()
    64     del repo2, cnx2, repo3, cnx3
    64     del repo2, cnx2, repo3, cnx3
    65     #del TwoSourcesTC.config.vreg
    65     #del TwoSourcesTC.config.vreg
    66     #del TwoSourcesTC.config
    66     #del TwoSourcesTC.config
       
    67     TestServerConfiguration.no_sqlite_wrap = False
    67 
    68 
    68 class TwoSourcesTC(CubicWebTC):
    69 class TwoSourcesTC(CubicWebTC):
    69     config = TwoSourcesConfiguration('data')
    70     config = TwoSourcesConfiguration('data')
    70 
    71 
    71     @classmethod
    72     @classmethod