~free.ekanayaka/storm/any-expr

« back to all changes in this revision

Viewing changes to tests/databases/postgres.py

  • Committer: Andreas Hasenack
  • Date: 2008-11-19 18:22:29 UTC
  • mto: This revision was merged to the branch mainline in revision 284.
  • Revision ID: andreas@canonical.com-20081119182229-ow5vqejqsyaxm6zv
Added "clean" target to the Makefile

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from storm.databases.postgres import (
25
25
    Postgres, compile, currval, Returning, PostgresTimeoutTracer)
26
26
from storm.database import create_database
27
 
from storm.exceptions import InterfaceError, ProgrammingError
 
27
from storm.exceptions import ProgrammingError
28
28
from storm.variables import DateTimeVariable, RawStrVariable
29
29
from storm.variables import ListVariable, IntVariable, Variable
30
30
from storm.properties import Int
526
526
    host_environment_variable = "STORM_POSTGRES_HOST_URI"
527
527
    default_port = 5432
528
528
 
529
 
    def test_rollback_swallows_InterfaceError(self):
530
 
        """Test that InterfaceErrors get caught on rollback().
531
 
 
532
 
        InterfaceErrors are a form of a disconnection error, so rollback()
533
 
        must swallow them and reconnect.
534
 
        """
535
 
        class FakeConnection:
536
 
            def rollback(self):
537
 
                raise InterfaceError('connection already closed')
538
 
        self.connection._raw_connection = FakeConnection()
539
 
        try:
540
 
            self.connection.rollback()
541
 
        except Exception, exc:
542
 
            self.fail('Exception should have been swallowed: %s' % repr(exc))
543
 
 
544
529
 
545
530
class PostgresTimeoutTracerTest(TimeoutTracerTestBase):
546
531