Exemplo n.º 1
0
 def test_get_current_revision_error_if_starting_rev_given_online(self):
     context = self.make_one(connection=self.connection,
                             opts={'starting_rev': 'boo'})
     assert_raises(
         CommandError,
         context.get_current_revision
     )
Exemplo n.º 2
0
 def test_get_current_revision_error_if_starting_rev_given_online(self):
     context = self.make_one(connection=self.connection,
                             opts={'starting_rev': 'boo'})
     assert_raises(
         CommandError,
         context.get_current_revision
     )
Exemplo n.º 3
0
 def test_pk_constraint_normally_prevents_dupe_rows(self):
     self._env_fixture()
     command.revision(self.cfg)
     r2 = command.revision(self.cfg)
     db = _sqlite_file_db()
     command.upgrade(self.cfg, "head")
     assert_raises(
         sqla_exc.IntegrityError, db.execute,
         "insert into alembic_version values ('%s')" % r2.revision)
Exemplo n.º 4
0
 def test_pk_constraint_normally_prevents_dupe_rows(self):
     self._env_fixture()
     command.revision(self.cfg)
     r2 = command.revision(self.cfg)
     db = _sqlite_file_db()
     command.upgrade(self.cfg, "head")
     assert_raises(
         sqla_exc.IntegrityError,
         db.execute,
         "insert into alembic_version values ('%s')" % r2.revision,
     )
Exemplo n.º 5
0
    def test_proxy_transaction_contextmanager_rollback(self):
        context = self._fixture(
            {"transaction_per_migration": True, "transactional_ddl": True}
        )
        proxy = context.begin_transaction(_per_migration=True)
        is_true(self.conn.in_transaction())

        def go():
            with proxy:
                raise Exception("hi")

        assert_raises(Exception, go)
        is_false(self.conn.in_transaction())