diff --git a/tests/test_async.py b/tests/test_async.py index fbb5809d..18fefc6b 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 4c60c0b7..7068ba54 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 a23457ee..ec53ba34 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: