~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/pgsql.py

  • Committer: Stuart Bishop
  • Date: 2011-09-05 15:42:27 UTC
  • mto: (13813.4.4 pgbouncer-fixture)
  • mto: This revision was merged to the branch mainline in revision 13875.
  • Revision ID: stuart.bishop@canonical.com-20110905154227-ke7d9fy9jr9uk87y
Revert reversion in launchpad/devel r13865

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
'''
41
41
    def close(self):
42
42
        if self in PgTestSetup.connections:
43
43
            PgTestSetup.connections.remove(self)
44
 
            self.real_connection.close()
 
44
            try:
 
45
                self.real_connection.close()
 
46
            except psycopg2.InterfaceError:
 
47
                pass # Already closed, killed etc. Ignore.
45
48
 
46
49
    def rollback(self, InterfaceError=psycopg2.InterfaceError):
47
50
        # In our test suites, rollback ends up being called twice in some
186
189
                # available.
187
190
                # Avoid circular imports
188
191
                section = """[database]
189
 
rw_main_master: dbname=%s
190
 
rw_main_slave:  dbname=%s
 
192
rw_main_master: dbname=%s host=localhost
 
193
rw_main_slave:  dbname=%s host=localhost
191
194
 
192
195
""" % (self.dbname, self.dbname)
193
196
                if BaseLayer.config_fixture is not None: