~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/database/ftests/script_isolation.py

  • Committer: William Grant
  • Date: 2011-09-24 03:56:19 UTC
  • mto: This revision was merged to the branch mainline in revision 14030.
  • Revision ID: william.grant@canonical.com-20110924035619-ht8qu83op75xhdgr
LaunchpadScript no longer uses initZopeless.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import transaction
20
20
 
21
 
from canonical.database.sqlbase import (
22
 
    cursor,
23
 
    ISOLATION_LEVEL_SERIALIZABLE,
24
 
    ZopelessTransactionManager,
25
 
    )
 
21
from canonical.config import dbconfig
 
22
from canonical.database.sqlbase import cursor
26
23
from canonical.launchpad.scripts import execute_zcml_for_scripts
 
24
from canonical.testing.layers import disconnect_stores
27
25
 
28
26
execute_zcml_for_scripts()
29
27
 
 
28
 
30
29
def check():
31
30
    cur = cursor()
32
31
    cur.execute("UPDATE Person SET homepage_content='foo' WHERE name='mark'")
41
40
    cur.execute("SHOW transaction_isolation")
42
41
    print cur.fetchone()[0]
43
42
 
44
 
# First confirm the default isolation level
45
 
ZopelessTransactionManager.initZopeless(dbuser='launchpad_main')
 
43
dbconfig.override(dbuser='launchpad_main', isolation_level='read_committed')
 
44
disconnect_stores()
46
45
check()
47
 
ZopelessTransactionManager.uninstall()
48
46
 
49
 
ZopelessTransactionManager.initZopeless(
50
 
    dbuser='launchpad_main',
51
 
    isolation=ISOLATION_LEVEL_SERIALIZABLE)
 
47
dbconfig.override(isolation_level='serializable')
 
48
disconnect_stores()
52
49
check()
53
 
ZopelessTransactionManager.uninstall()