sqlalchemy.exc.InternalError - python examples

Here are the examples of the python api sqlalchemy.exc.InternalError taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

3 View Complete Implementation : test_audit.py
Copyright MIT License
Author : huskar-org
def test_create_lost_audit(faker, mocker, user):
    hook = mocker.patch('huskar_api.models.audit.audit._publish_new_action')
    session = mocker.patch('huskar_api.models.audit.audit.DBSession')
    session.side_effect = [InternalError(None, None, None, None)]
    action = (action_types.UPDATE_CONFIG, 'data', [(TYPE_SITE, 0)])
    with raises(AuditLogLostError):
        AuditLog.create(user.id, faker.ipv4(), action)

    hook.astert_called_once()

3 View Complete Implementation : test_for_update.py
Copyright MIT License
Author : sqlalchemy
    def _astert_a_is_locked(self, should_be_locked):
        A = self.clastes.A
        with testing.db.begin() as alt_trans:
            alt_trans.execute("set innodb_lock_wait_timeout=1")
            # set x/y > 10
            try:
                alt_trans.execute(update(A).values(x=15, y=19))
            except (exc.InternalError, exc.OperationalError) as err:
                astert "Lock wait timeout exceeded" in str(err)
                astert should_be_locked
            else:
                astert not should_be_locked

3 View Complete Implementation : test_for_update.py
Copyright MIT License
Author : sqlalchemy
    def _astert_b_is_locked(self, should_be_locked):
        B = self.clastes.B
        with testing.db.begin() as alt_trans:
            alt_trans.execute("set innodb_lock_wait_timeout=1")
            # set x/y > 10
            try:
                alt_trans.execute(update(B).values(x=15, y=19))
            except (exc.InternalError, exc.OperationalError) as err:
                astert "Lock wait timeout exceeded" in str(err)
                astert should_be_locked
            else:
                astert not should_be_locked