# Path: axiom/errors.py
# class TimeoutError(Exception):
#     """
#     A low-level SQL operation timed out.
# 
#     @ivar statement: The SQL statement which timed out.
#     @ivar timeout: The timeout, in seconds, which was exceeded.
#     @ivar underlying: The backend exception which signaled this, or None.
#     """
#     def __init__(self, statement, timeout, underlying):
#         Exception.__init__(self, statement, timeout, underlying)
#         self.statement = statement
#         self.timeout = timeout
#         self.underlying = underlying
# 
# class TableAlreadyExists(SQLError):
#     """
#     Axiom internally created a table at the same time as another database.
#     (User code should not need to catch this exception.)
#     """
# 
# class SQLError(RuntimeError):
#     """
#     Axiom internally generated some bad SQL.
#     """
#     def __init__(self, sql, args, underlying):
#         RuntimeError.__init__(self, sql, args, underlying)
#         self.sql, self.args, self.underlying = self.args
# 
#     def __str__(self):
#         return "<SQLError: {!r}({!r}) caused {}: {}>".format(
#             self.sql, self.args,
#             self.underlying.__class__, self.underlying)


from axiom.errors import TimeoutError, TableAlreadyExists, SQLError
        self.assertEqual(len(stubConnection.cursors[0].statements), 1)
        self.assertEqual(stubConnection.cursors[0].statements[0], statement)


    def test_timeoutExceeded(self):
        """
        Test that the timeout we pass to the Connection is respected.
        """
        clock = [0]
        def time():
            return clock[0]
        def sleep(n):
            clock[0] += n

        stubConnection = self.createStubConnection()
        axiomConnection = self.createAxiomConnection(stubConnection, timeout=self.TIMEOUT)
        axiomCursor = axiomConnection.cursor()

        axiomCursor.time = time
        axiomCursor.sleep = sleep

        def execute(statement, args=()):
            if time() < self.TIMEOUT * 2:
                return stubConnection.timeout()
            return object()

        stubConnection.cursors[0].execute = execute

        statement = 'SELECT foo FROM bar'
        timeoutException = self.assertRaises(

# Path: axiom/errors.py
# class TimeoutError(Exception):
#     """
#     A low-level SQL operation timed out.
# 
#     @ivar statement: The SQL statement which timed out.
#     @ivar timeout: The timeout, in seconds, which was exceeded.
#     @ivar underlying: The backend exception which signaled this, or None.
#     """
#     def __init__(self, statement, timeout, underlying):
#         Exception.__init__(self, statement, timeout, underlying)
#         self.statement = statement
#         self.timeout = timeout
#         self.underlying = underlying
# 
# class TableAlreadyExists(SQLError):
#     """
#     Axiom internally created a table at the same time as another database.
#     (User code should not need to catch this exception.)
#     """
# 
# class SQLError(RuntimeError):
#     """
#     Axiom internally generated some bad SQL.
#     """
#     def __init__(self, sql, args, underlying):
#         RuntimeError.__init__(self, sql, args, underlying)
#         self.sql, self.args, self.underlying = self.args
# 
#     def __str__(self):
#         return "<SQLError: {!r}({!r}) caused {}: {}>".format(
#             self.sql, self.args,
#             self.underlying.__class__, self.underlying)


# Path: axiom/test/cursortest.py
from axiom.errors import TimeoutError, TableAlreadyExists, SQLError

        self.assertEqual(len(stubConnection.cursors[0].statements), 1)
        self.assertEqual(stubConnection.cursors[0].statements[0], statement)


    def test_timeoutExceeded(self):
        """
        Test that the timeout we pass to the Connection is respected.
        """
        clock = [0]
        def time():
            return clock[0]
        def sleep(n):
            clock[0] += n

        stubConnection = self.createStubConnection()
        axiomConnection = self.createAxiomConnection(stubConnection, timeout=self.TIMEOUT)
        axiomCursor = axiomConnection.cursor()

        axiomCursor.time = time
        axiomCursor.sleep = sleep

        def execute(statement, args=()):
            if time() < self.TIMEOUT * 2:
                return stubConnection.timeout()
            return object()

        stubConnection.cursors[0].execute = execute

        statement = 'SELECT foo FROM bar'
        timeoutException = self.assertRaises(

            TimeoutError,