~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/testing/layers.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-09-21 13:00:42 UTC
  • mfrom: (13993.2.4 overlayless-ztm)
  • Revision ID: launchpad@pqm.canonical.com-20110921130042-oiuotq9rkoss3n95
[r=sinzui][bug=272323] ZopelessTransactionManager now uses
 DatabaseConfig.override instead of lazr.config overlays.

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
            store.close()
211
211
 
212
212
 
213
 
def reconnect_stores(database_config_section='launchpad'):
 
213
def reconnect_stores(database_config_section=None):
214
214
    """Reconnect Storm stores, resetting the dbconfig to its defaults.
215
215
 
216
216
    After reconnecting, the database revision will be checked to make
217
217
    sure the right data is available.
218
218
    """
219
219
    disconnect_stores()
220
 
    section = getattr(config, database_config_section)
221
 
    dbconfig.override(
222
 
        dbuser=getattr(section, 'dbuser', None),
223
 
        isolation_level=getattr(section, 'isolation_level', None))
 
220
    if database_config_section:
 
221
        section = getattr(config, database_config_section)
 
222
        dbconfig.override(
 
223
            dbuser=getattr(section, 'dbuser', None),
 
224
            isolation_level=getattr(section, 'isolation_level', None))
224
225
 
225
226
    main_store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
226
227
    assert main_store is not None, 'Failed to reconnect'
1352
1353
    @profiled
1353
1354
    def testSetUp(cls):
1354
1355
        # Connect Storm
1355
 
        reconnect_stores()
 
1356
        reconnect_stores('launchpad')
1356
1357
 
1357
1358
    @classmethod
1358
1359
    @profiled
1383
1384
        OpStats.resetStats()
1384
1385
 
1385
1386
        # Connect Storm
1386
 
        reconnect_stores()
 
1387
        reconnect_stores('launchpad')
1387
1388
 
1388
1389
    @classmethod
1389
1390
    @profiled
1450
1451
    def testSetUp(cls):
1451
1452
        # LaunchpadZopelessLayer takes care of reconnecting the stores
1452
1453
        if not LaunchpadZopelessLayer.isSetUp:
1453
 
            reconnect_stores()
 
1454
            reconnect_stores('launchpad')
1454
1455
 
1455
1456
    @classmethod
1456
1457
    @profiled
1488
1489
    def testSetUp(cls):
1489
1490
        # LaunchpadZopelessLayer takes care of reconnecting the stores
1490
1491
        if not LaunchpadZopelessLayer.isSetUp:
1491
 
            reconnect_stores()
 
1492
            reconnect_stores('launchpad')
1492
1493
 
1493
1494
    @classmethod
1494
1495
    @profiled