summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-08-17 21:27:25 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-08-17 21:27:25 +0100
commit6d8382b7ed8df61ee2cb90bc43c5150f9fb56664 (patch)
treeaef88cabb118170c0b06666e15732cd498ce88a9
parent513b0019b19d10fdb28ef8a80cf6ab0022109f2c (diff)
downloadpsycopg2-6d8382b7ed8df61ee2cb90bc43c5150f9fb56664.tar.gz
Added missing reasons for crdb skip
Added check to make sure a reason must be passed.
-rwxr-xr-xtests/test_async.py10
-rwxr-xr-xtests/test_types_basic.py4
-rw-r--r--tests/testutils.py3
3 files changed, 10 insertions, 7 deletions
diff --git a/tests/test_async.py b/tests/test_async.py
index 57207a0..eb97bc9 100755
--- a/tests/test_async.py
+++ b/tests/test_async.py
@@ -355,7 +355,7 @@ class AsyncTests(ConnectingTestCase):
self.assertEquals(cur.fetchone()[0], 1)
@slow
- @skip_if_crdb
+ @skip_if_crdb("notify")
def test_notify(self):
cur = self.conn.cursor()
sync_cur = self.sync_conn.cursor()
@@ -433,7 +433,7 @@ class AsyncTests(ConnectingTestCase):
self.wait(cur2)
self.assertEquals(cur2.fetchone()[0], 1)
- @skip_if_crdb
+ @skip_if_crdb("notice")
def test_notices(self):
del self.conn.notices[:]
cur = self.conn.cursor()
@@ -458,7 +458,7 @@ class AsyncTests(ConnectingTestCase):
self.wait(self.conn)
self.assertEqual(cur.fetchone(), (42,))
- @skip_if_crdb
+ @skip_if_crdb("copy")
def test_async_connection_error_message(self):
try:
cnn = psycopg2.connect('dbname=thisdatabasedoesntexist', async_=True)
@@ -476,7 +476,7 @@ class AsyncTests(ConnectingTestCase):
self.assertRaises(psycopg2.ProgrammingError, self.wait, self.conn)
@slow
- @skip_if_crdb
+ @skip_if_crdb("notice")
@skip_before_postgres(9, 0)
def test_non_block_after_notification(self):
from select import select
@@ -510,7 +510,7 @@ class AsyncTests(ConnectingTestCase):
def test_poll_noop(self):
self.conn.poll()
- @skip_if_crdb
+ @skip_if_crdb("notify")
@skip_before_postgres(9, 0)
def test_poll_conn_for_notification(self):
with self.conn.cursor() as cur:
diff --git a/tests/test_types_basic.py b/tests/test_types_basic.py
index e5e116a..efdff73 100755
--- a/tests/test_types_basic.py
+++ b/tests/test_types_basic.py
@@ -173,7 +173,7 @@ class TypesBasicTests(ConnectingTestCase):
curs.execute("select col from array_test where id = 2")
self.assertEqual(curs.fetchone()[0], [])
- @skip_if_crdb
+ @skip_if_crdb("nested array")
@testutils.skip_before_postgres(8, 4)
def testNestedEmptyArray(self):
# issue #788
@@ -276,7 +276,7 @@ class TypesBasicTests(ConnectingTestCase):
curs.execute("insert into na (boolaa) values (%s)", ([[True, None]],))
curs.execute("insert into na (boolaa) values (%s)", ([[None, None]],))
- @skip_if_crdb
+ @skip_if_crdb("nested array")
@testutils.skip_before_postgres(8, 2)
def testNestedArrays(self):
curs = self.conn.cursor()
diff --git a/tests/testutils.py b/tests/testutils.py
index 12b0bcf..58190fe 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -449,6 +449,9 @@ def skip_if_crdb(reason, conn=None):
Or as a normal function if the *conn* argument is passed.
"""
+ if not isinstance(reason, str):
+ raise TypeError("reason should be a string, got %r instead" % reason)
+
if conn is not None:
if crdb_version(conn) is not None:
raise unittest.SkipTest("not supported on CockroachDB: %s" % reason)