Skip cancel tests on CockroachDB

One test moved to the async tests module, as it really belongs there.
This commit is contained in:
Daniele Varrazzo 2020-07-21 02:15:53 +01:00
parent ee34198bf6
commit f8c1cff6a3
3 changed files with 12 additions and 8 deletions

View File

@ -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__)

View File

@ -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__)

View File

@ -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: