diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2017-02-03 04:45:17 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2017-02-03 04:45:17 +0000 |
commit | 1911b250e33e140bbbc25f3536bda24e8ca35bdb (patch) | |
tree | c18202b036fb5e5570c3556e852efae9a4dee76e /tests/testutils.py | |
parent | 6e89db020ca9fd93260bfff7aadef64dd4535553 (diff) | |
parent | 44c3b776917444ca98667f5d6f4470c767f820bf (diff) | |
download | psycopg2-1911b250e33e140bbbc25f3536bda24e8ca35bdb.tar.gz |
Merge branch 'async-keyword'
Close #495
Diffstat (limited to 'tests/testutils.py')
-rw-r--r-- | tests/testutils.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/testutils.py b/tests/testutils.py index c36f674..f1c93de 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -50,7 +50,9 @@ else: @wraps(f) def skipIf__(self): if cond: - warnings.warn(msg) + with warnings.catch_warnings(): + warnings.simplefilter('always', UserWarning) + warnings.warn(msg) return else: return f(self) @@ -61,7 +63,9 @@ else: return skipIf(True, msg) def skipTest(self, msg): - warnings.warn(msg) + with warnings.catch_warnings(): + warnings.simplefilter('always', UserWarning) + warnings.warn(msg) return unittest.TestCase.skipTest = skipTest @@ -130,7 +134,7 @@ class ConnectingTestCase(unittest.TestCase): import psycopg2 try: conn = self.connect(**kwargs) - if conn.async == 1: + if conn.async_ == 1: self.wait(conn) except psycopg2.OperationalError, e: # If pgcode is not set it is a genuine connection error @@ -469,3 +473,7 @@ def slow(f): return self.skipTest("slow test") return f(self) return slow_ + + +def assertDsnEqual(testsuite, dsn1, dsn2): + testsuite.assertEqual(set(dsn1.split()), set(dsn2.split())) |