diff options
-rw-r--r-- | oslo/db/sqlalchemy/exc_filters.py | 2 | ||||
-rw-r--r-- | tests/sqlalchemy/test_exc_filters.py | 12 | ||||
-rw-r--r-- | tests/sqlalchemy/test_handle_error.py | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/oslo/db/sqlalchemy/exc_filters.py b/oslo/db/sqlalchemy/exc_filters.py index d4d9438..03fa8c9 100644 --- a/oslo/db/sqlalchemy/exc_filters.py +++ b/oslo/db/sqlalchemy/exc_filters.py @@ -309,7 +309,7 @@ def handler(context): if super_ in per_dialect: regexp_reg = per_dialect[super_] for fn, regexp in regexp_reg: - match = regexp.match(exc.message) + match = regexp.match(exc.args[0]) if match: try: fn( diff --git a/tests/sqlalchemy/test_exc_filters.py b/tests/sqlalchemy/test_exc_filters.py index 42e4365..51eb58a 100644 --- a/tests/sqlalchemy/test_exc_filters.py +++ b/tests/sqlalchemy/test_exc_filters.py @@ -117,7 +117,7 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter): self.assertEqual( "(ProgrammingError) Error 123, you made a " "mistake 'select you_made_a_programming_error' ()", - matched.message) + matched.args[0]) def test_generic_dbapi_disconnect(self): matched = self._run_test( @@ -129,7 +129,7 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter): self.assertEqual( "(InterfaceError) connection lost " "'select the_db_disconnected' ()", - matched.message) + matched.args[0]) def test_operational_dbapi_disconnect(self): matched = self._run_test( @@ -141,7 +141,7 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter): self.assertEqual( "(OperationalError) connection lost " "'select the_db_disconnected' ()", - matched.message) + matched.args[0]) def test_operational_error_asis(self): """test that SQLAlchemy OperationalErrors that aren't disconnects @@ -155,7 +155,7 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter): ) self.assertEqual( "(OperationalError) some op error", - matched.message) + matched.args[0]) def test_unicode_encode(self): # intentionally generate a UnicodeEncodeError, as its @@ -178,7 +178,7 @@ class TestFallthroughsAndNonDBAPI(TestsExceptionFilter): AttributeError("mysqldb has an attribute error"), exception.DBError ) - self.assertEqual("mysqldb has an attribute error", matched.message) + self.assertEqual("mysqldb has an attribute error", matched.args[0]) class TestRaiseReferenceError(TestsExceptionFilter): @@ -283,7 +283,7 @@ class TestDuplicate(TestsExceptionFilter): self.IntegrityError(message), expected_cls ) - self.assertEqual(expected_message, matched.message) + self.assertEqual(expected_message, matched.args[0]) def test_sqlite(self): self._run_dupe_constraint_test("sqlite", 'column a, b are not unique') diff --git a/tests/sqlalchemy/test_handle_error.py b/tests/sqlalchemy/test_handle_error.py index a9e6f62..121d07b 100644 --- a/tests/sqlalchemy/test_handle_error.py +++ b/tests/sqlalchemy/test_handle_error.py @@ -62,7 +62,7 @@ class ExceptionReraiseTest(test_base.BaseTestCase): self.engine.execute, "SELECT 'ERROR ONE' FROM I_DONT_EXIST" ) self.assertEqual(1, patched.call_count) - self.assertEqual("my exception", matchee.message) + self.assertEqual("my exception", matchee.args[0]) def test_exception_event_non_altered(self): self._fixture() |