diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2013-10-16 15:28:16 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2013-10-16 17:50:10 +0100 |
commit | 1e623a951c88e3640849e44d73aeb384ef59fde7 (patch) | |
tree | d43c65f9aefc573694fd5603c5a771bbeeb8bd75 /tests/test_async.py | |
parent | 345077d5f78900ec95691ff047499526a4aabfbe (diff) | |
download | psycopg2-1e623a951c88e3640849e44d73aeb384ef59fde7.tar.gz |
Meaningful connection errors report a meaningful message
Fixes issue #173.
Diffstat (limited to 'tests/test_async.py')
-rwxr-xr-x | tests/test_async.py | 10 |
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__) |