summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexei Kornienko <akornienko@mirantis.com>2014-08-01 15:48:34 +0300
committerRoman Podoliaka <rpodolyaka@mirantis.com>2014-08-01 14:02:14 +0000
commit584a8834889f7f5fac4b598e63bbcc8e1dd53abe (patch)
treebdfd9744eafbe689c076de865c73f9bab8d6aaf4 /tests
parentfc2fc90eb0af88303914ca9271165da399f08c5c (diff)
downloadoslo-db-584a8834889f7f5fac4b598e63bbcc8e1dd53abe.tar.gz
Fixed DeprecationWarning in exc_filters
DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 This warning was generated in exc_filters during exception conversions. Fix it by removing access to deprecated attribute Closes-Bug: #1257530 Change-Id: I8ff8b974946ecab13f12a70b315dd94c3453197e
Diffstat (limited to 'tests')
-rw-r--r--tests/sqlalchemy/test_exc_filters.py12
-rw-r--r--tests/sqlalchemy/test_handle_error.py2
2 files changed, 7 insertions, 7 deletions
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()