mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Added missing reasons for crdb skip
Added check to make sure a reason must be passed.
This commit is contained in:
parent
513b0019b1
commit
6d8382b7ed
|
@ -355,7 +355,7 @@ class AsyncTests(ConnectingTestCase):
|
||||||
self.assertEquals(cur.fetchone()[0], 1)
|
self.assertEquals(cur.fetchone()[0], 1)
|
||||||
|
|
||||||
@slow
|
@slow
|
||||||
@skip_if_crdb
|
@skip_if_crdb("notify")
|
||||||
def test_notify(self):
|
def test_notify(self):
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
sync_cur = self.sync_conn.cursor()
|
sync_cur = self.sync_conn.cursor()
|
||||||
|
@ -433,7 +433,7 @@ class AsyncTests(ConnectingTestCase):
|
||||||
self.wait(cur2)
|
self.wait(cur2)
|
||||||
self.assertEquals(cur2.fetchone()[0], 1)
|
self.assertEquals(cur2.fetchone()[0], 1)
|
||||||
|
|
||||||
@skip_if_crdb
|
@skip_if_crdb("notice")
|
||||||
def test_notices(self):
|
def test_notices(self):
|
||||||
del self.conn.notices[:]
|
del self.conn.notices[:]
|
||||||
cur = self.conn.cursor()
|
cur = self.conn.cursor()
|
||||||
|
@ -458,7 +458,7 @@ class AsyncTests(ConnectingTestCase):
|
||||||
self.wait(self.conn)
|
self.wait(self.conn)
|
||||||
self.assertEqual(cur.fetchone(), (42,))
|
self.assertEqual(cur.fetchone(), (42,))
|
||||||
|
|
||||||
@skip_if_crdb
|
@skip_if_crdb("copy")
|
||||||
def test_async_connection_error_message(self):
|
def test_async_connection_error_message(self):
|
||||||
try:
|
try:
|
||||||
cnn = psycopg2.connect('dbname=thisdatabasedoesntexist', async_=True)
|
cnn = psycopg2.connect('dbname=thisdatabasedoesntexist', async_=True)
|
||||||
|
@ -476,7 +476,7 @@ class AsyncTests(ConnectingTestCase):
|
||||||
self.assertRaises(psycopg2.ProgrammingError, self.wait, self.conn)
|
self.assertRaises(psycopg2.ProgrammingError, self.wait, self.conn)
|
||||||
|
|
||||||
@slow
|
@slow
|
||||||
@skip_if_crdb
|
@skip_if_crdb("notice")
|
||||||
@skip_before_postgres(9, 0)
|
@skip_before_postgres(9, 0)
|
||||||
def test_non_block_after_notification(self):
|
def test_non_block_after_notification(self):
|
||||||
from select import select
|
from select import select
|
||||||
|
@ -510,7 +510,7 @@ class AsyncTests(ConnectingTestCase):
|
||||||
def test_poll_noop(self):
|
def test_poll_noop(self):
|
||||||
self.conn.poll()
|
self.conn.poll()
|
||||||
|
|
||||||
@skip_if_crdb
|
@skip_if_crdb("notify")
|
||||||
@skip_before_postgres(9, 0)
|
@skip_before_postgres(9, 0)
|
||||||
def test_poll_conn_for_notification(self):
|
def test_poll_conn_for_notification(self):
|
||||||
with self.conn.cursor() as cur:
|
with self.conn.cursor() as cur:
|
||||||
|
|
|
@ -173,7 +173,7 @@ class TypesBasicTests(ConnectingTestCase):
|
||||||
curs.execute("select col from array_test where id = 2")
|
curs.execute("select col from array_test where id = 2")
|
||||||
self.assertEqual(curs.fetchone()[0], [])
|
self.assertEqual(curs.fetchone()[0], [])
|
||||||
|
|
||||||
@skip_if_crdb
|
@skip_if_crdb("nested array")
|
||||||
@testutils.skip_before_postgres(8, 4)
|
@testutils.skip_before_postgres(8, 4)
|
||||||
def testNestedEmptyArray(self):
|
def testNestedEmptyArray(self):
|
||||||
# issue #788
|
# 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)", ([[True, None]],))
|
||||||
curs.execute("insert into na (boolaa) values (%s)", ([[None, 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)
|
@testutils.skip_before_postgres(8, 2)
|
||||||
def testNestedArrays(self):
|
def testNestedArrays(self):
|
||||||
curs = self.conn.cursor()
|
curs = self.conn.cursor()
|
||||||
|
|
|
@ -449,6 +449,9 @@ def skip_if_crdb(reason, conn=None):
|
||||||
|
|
||||||
Or as a normal function if the *conn* argument is passed.
|
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 conn is not None:
|
||||||
if crdb_version(conn) is not None:
|
if crdb_version(conn) is not None:
|
||||||
raise unittest.SkipTest("not supported on CockroachDB: %s" % reason)
|
raise unittest.SkipTest("not supported on CockroachDB: %s" % reason)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user