Closed Nicoretti closed 1 year ago
Add the tests below to test/test_suit.py and execute the integration tests or just the test itself. (using the turbodbc connector)
test/test_suit.py
from sqlalchemy.testing.suite import ExceptionTest as _ExceptionTest from sqlalchemy import text class ExceptionTest(_ExceptionTest): def test_integrity_error(self): with config.db.connect() as conn: trans = conn.begin() conn.execute( self.tables.manual_pk.insert(), {"id": 1, "data": "d1"} ) assert_raises( exc.IntegrityError, conn.execute, self.tables.manual_pk.insert(), {"id": 1, "data": "d1"}, ) trans.rollback() def test_integrity_error_raw_sql(self): with config.db.connect() as conn: statement = text("INSERT INTO MANUAL_PK VALUES (1, 'd1')") conn.execute(statement) assert_raises( exc.IntegrityError, conn.execute, statement )
:heavy_check_mark: Test passes because an sqlalchemy.exec.IntegrityError is risen.
sqlalchemy.exec.IntegrityError
:boom: Test fails because no exception is risen.
Won't fix, turbodbc support will be dropped.
turbodbc
Steps To Reproduce:
Add the tests below to
test/test_suit.py
and execute the integration tests or just the test itself. (using the turbodbc connector)Expected Behavior
:heavy_check_mark: Test passes because an
sqlalchemy.exec.IntegrityError
is risen.Actual Behavior
:boom: Test fails because no exception is risen.
Related Issues