Fixed parse_dsn tests on Python 3

On Python 3 there is no Exception.message attribute.
This commit is contained in:
Daniele Varrazzo 2015-10-01 12:00:33 +01:00
parent d3bbd19ccb
commit 71d96293ab

View File

@ -333,7 +333,7 @@ class ParseDsnTestCase(ConnectingTestCase):
parse_dsn("dbname='test 2 user=tester password=secret")
except ProgrammingError, e:
raised = True
self.assertTrue(e.message.find('secret') < 0,
self.assertTrue(str(e).find('secret') < 0,
"DSN was not exposed in error message")
except e:
self.fail("unexpected error condition: " + repr(e))
@ -354,7 +354,7 @@ class ParseDsnTestCase(ConnectingTestCase):
parse_dsn('postgresql://tester:secret@/test?port=1111=x')
except ProgrammingError, e:
raised = True
self.assertTrue(e.message.find('secret') < 0,
self.assertTrue(str(e).find('secret') < 0,
"URI was not exposed in error message")
except e:
self.fail("unexpected error condition: " + repr(e))