From 7e8f35109725ed3fd3caf96acf8b94a13c53fdfe Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 9 Feb 2011 18:11:40 -0500 Subject: - Non-DBAPI errors which occur in the scope of an `execute()` call are now wrapped in sqlalchemy.exc.StatementError, and the text of the SQL statement and repr() of params is included. This makes it easier to identify statement executions which fail before the DBAPI becomes involved. [ticket:2015] --- test/sql/test_constraints.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/sql/test_constraints.py') diff --git a/test/sql/test_constraints.py b/test/sql/test_constraints.py index 4bacbd271..f4791c0bd 100644 --- a/test/sql/test_constraints.py +++ b/test/sql/test_constraints.py @@ -79,9 +79,9 @@ class ConstraintTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): metadata.create_all() foo.insert().execute(id=1,x=9,y=5) - assert_raises(exc.SQLError, foo.insert().execute, id=2,x=5,y=9) + assert_raises(exc.DBAPIError, foo.insert().execute, id=2,x=5,y=9) bar.insert().execute(id=1,x=10) - assert_raises(exc.SQLError, bar.insert().execute, id=2,x=5) + assert_raises(exc.DBAPIError, bar.insert().execute, id=2,x=5) def test_unique_constraint(self): foo = Table('foo', metadata, @@ -98,8 +98,8 @@ class ConstraintTest(TestBase, AssertsExecutionResults, AssertsCompiledSQL): foo.insert().execute(id=2, value='value2') bar.insert().execute(id=1, value='a', value2='a') bar.insert().execute(id=2, value='a', value2='b') - assert_raises(exc.SQLError, foo.insert().execute, id=3, value='value1') - assert_raises(exc.SQLError, bar.insert().execute, id=3, value='a', value2='b') + assert_raises(exc.DBAPIError, foo.insert().execute, id=3, value='value1') + assert_raises(exc.DBAPIError, bar.insert().execute, id=3, value='a', value2='b') def test_index_create(self): employees = Table('employees', metadata, -- cgit v1.2.1