diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2016-12-26 12:06:21 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2016-12-26 12:06:21 +0100 |
commit | 7caba160b7083c64197329e17d0d0e0eb17c8639 (patch) | |
tree | 9c7a8221ccdbbf3efdbac0ccd49287cc90647a6f /tests/testutils.py | |
parent | 121cf3b8f8426765d983579d3a4b2e932429cd9f (diff) | |
parent | e9577e9b890fd9a27bb146e8ea1c24eb562f28b2 (diff) | |
download | psycopg2-7caba160b7083c64197329e17d0d0e0eb17c8639.tar.gz |
Merge branch 'master' into fast-codecs
Diffstat (limited to 'tests/testutils.py')
-rw-r--r-- | tests/testutils.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/testutils.py b/tests/testutils.py index d0a34bc..9347735 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -122,13 +122,25 @@ class ConnectingTestCase(unittest.TestCase): Should raise a skip test if not available, but guard for None on old Python versions. """ + if repl_dsn is None: + return self.skipTest("replication tests disabled by default") + if 'dsn' not in kwargs: kwargs['dsn'] = repl_dsn import psycopg2 try: conn = self.connect(**kwargs) + if conn.async == 1: + self.wait(conn) except psycopg2.OperationalError, e: - return self.skipTest("replication db not configured: %s" % e) + # If pgcode is not set it is a genuine connection error + # Otherwise we tried to run some bad operation in the connection + # (e.g. bug #482) and we'd rather know that. + if e.pgcode is None: + return self.skipTest("replication db not configured: %s" % e) + else: + raise + return conn def _get_conn(self): |