summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-07-21 02:15:53 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-07-21 22:21:32 +0100
commitf8c1cff6a343bb4d21bd8efef459484f5426f674 (patch)
tree13d0cbcd39d5089711f446963513a3915724e26e
parentee34198bf6a16080bb71d8ab68b354380745b3a8 (diff)
downloadpsycopg2-f8c1cff6a343bb4d21bd8efef459484f5426f674.tar.gz
Skip cancel tests on CockroachDB
One test moved to the async tests module, as it really belongs there.
-rwxr-xr-xtests/test_async.py5
-rwxr-xr-xtests/test_cancel.py9
-rw-r--r--tests/testutils.py6
3 files changed, 12 insertions, 8 deletions
diff --git a/tests/test_async.py b/tests/test_async.py
index fbb5809..18fefc6 100755
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -532,6 +532,11 @@ class AsyncTests(ConnectingTestCase):
else:
self.fail("No notification received")
+ def test_close(self):
+ self.conn.close()
+ self.assertTrue(self.conn.closed)
+ self.assertTrue(self.conn.async_)
+
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
diff --git a/tests/test_cancel.py b/tests/test_cancel.py
index 4c60c0b..7068ba5 100755
--- a/tests/test_cancel.py
+++ b/tests/test_cancel.py
@@ -34,12 +34,16 @@ from psycopg2 import extras
from .testconfig import dsn
import unittest
from .testutils import ConnectingTestCase, skip_before_postgres, slow
+from .testutils import crdb_version
class CancelTests(ConnectingTestCase):
def setUp(self):
ConnectingTestCase.setUp(self)
+ # here, instead of a decorator, to avoid creating the temp table
+ if crdb_version(self.conn) is not None:
+ self.skipTest("cancel not supported on CockroachDB")
cur = self.conn.cursor()
cur.execute('''
@@ -106,11 +110,6 @@ class CancelTests(ConnectingTestCase):
extras.wait_select(async_conn)
self.assertEqual(cur.fetchall(), [(1, )])
- def test_async_connection_cancel(self):
- async_conn = psycopg2.connect(dsn, async_=True)
- async_conn.close()
- self.assertTrue(async_conn.closed)
-
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
diff --git a/tests/testutils.py b/tests/testutils.py
index a23457e..ec53ba3 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -409,13 +409,13 @@ def skip_if_windows(cls):
def crdb_version(conn, __crdb_version=[]):
"""
- Return the CockroachDB version if that's the db testing, else None.
+ Return the CockroachDB version if that's the db being tested, else None.
Return the number as an integer similar to PQserverVersion: return
v20.1.3 as 200103.
- Assume all the connections are on the same db: return a chached result on
- following runs.
+ Assume all the connections are on the same db: return a cached result on
+ following calls.
"""
if __crdb_version: