summaryrefslogtreecommitdiff
path: root/tests/test_async.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-10-16 15:28:16 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2013-10-16 17:50:10 +0100
commit1e623a951c88e3640849e44d73aeb384ef59fde7 (patch)
treed43c65f9aefc573694fd5603c5a771bbeeb8bd75 /tests/test_async.py
parent345077d5f78900ec95691ff047499526a4aabfbe (diff)
downloadpsycopg2-1e623a951c88e3640849e44d73aeb384ef59fde7.tar.gz
Meaningful connection errors report a meaningful message
Fixes issue #173.
Diffstat (limited to 'tests/test_async.py')
-rwxr-xr-xtests/test_async.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_async.py b/tests/test_async.py
index 09604b5..981b49f 100755
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -449,6 +449,16 @@ class AsyncTests(ConnectingTestCase):
self.wait(self.conn)
self.assertEqual(cur.fetchone(), (42,))
+ def test_async_connection_error_message(self):
+ try:
+ cnn = psycopg2.connect('dbname=thisdatabasedoesntexist', async=True)
+ self.wait(cnn)
+ except psycopg2.Error, e:
+ self.assertNotEqual(str(e), "asynchronous connection failed",
+ "connection error reason lost")
+ else:
+ self.fail("no exception raised")
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)