summaryrefslogtreecommitdiff
path: root/tests/test_async.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-28 15:03:34 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2010-11-28 17:29:36 +0000
commit598b9424d27155b49d8ad1ca17dfa0c27b5ad974 (patch)
treec982d462cfe86e2089cfe21239ee1808703479fd /tests/test_async.py
parent2b6d2017ed4f199caa7e032100ac048ebc3978e2 (diff)
downloadpsycopg2-598b9424d27155b49d8ad1ca17dfa0c27b5ad974.tar.gz
Deal uniformly with test servers without pg_sleep.
Diffstat (limited to 'tests/test_async.py')
-rwxr-xr-xtests/test_async.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/tests/test_async.py b/tests/test_async.py
index 05b2344..96d7a2c 100755
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from testutils import unittest
+from testutils import unittest, skip_if_no_pg_sleep
import psycopg2
from psycopg2 import extensions
@@ -94,17 +94,15 @@ class AsyncTests(unittest.TestCase):
self.assertFalse(self.conn.isexecuting())
self.assertEquals(cur.fetchone()[0], "a")
+ @skip_if_no_pg_sleep('conn')
def test_async_callproc(self):
cur = self.conn.cursor()
- try:
- cur.callproc("pg_sleep", (0.1, ))
- self.assertTrue(self.conn.isexecuting())
-
- self.wait(cur)
- self.assertFalse(self.conn.isexecuting())
- self.assertEquals(cur.fetchall()[0][0], '')
- except psycopg2.ProgrammingError:
- return self.skipTest("PG < 8.1 did not have pg_sleep")
+ cur.callproc("pg_sleep", (0.1, ))
+ self.assertTrue(self.conn.isexecuting())
+
+ self.wait(cur)
+ self.assertFalse(self.conn.isexecuting())
+ self.assertEquals(cur.fetchall()[0][0], '')
def test_async_after_async(self):
cur = self.conn.cursor()