mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
Several other tests skipped for CockroachDB
The only remaining test modules in this branch are test_types_basic/extra.
This commit is contained in:
parent
a9153ac373
commit
c8697e6c67
|
@ -33,6 +33,7 @@ import psycopg2.extras
|
|||
from psycopg2.extensions import POLL_OK, POLL_READ, POLL_WRITE
|
||||
|
||||
from .testutils import ConnectingTestCase, skip_before_postgres, slow
|
||||
from .testutils import skip_if_crdb
|
||||
|
||||
|
||||
class ConnectionStub(object):
|
||||
|
@ -122,6 +123,7 @@ class GreenTestCase(ConnectingTestCase):
|
|||
cur.execute, "copy (select 1) to stdout")
|
||||
|
||||
@slow
|
||||
@skip_if_crdb
|
||||
@skip_before_postgres(9, 0)
|
||||
def test_non_block_after_notification(self):
|
||||
def wait(conn):
|
||||
|
@ -216,6 +218,7 @@ class CallbackErrorTestCase(ConnectingTestCase):
|
|||
|
||||
self.fail("you should have had a success or an error by now")
|
||||
|
||||
@skip_if_crdb
|
||||
def test_errors_named_cursor(self):
|
||||
for i in range(100):
|
||||
self.to_error = None
|
||||
|
|
|
@ -71,6 +71,7 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
cur.execute("select %s", [ip.ip_interface('::ffff:102:300/128')])
|
||||
self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
|
||||
|
||||
@testutils.skip_if_crdb
|
||||
def test_cidr_cast(self):
|
||||
cur = self.conn.cursor()
|
||||
psycopg2.extras.register_ipaddress(cur)
|
||||
|
@ -88,6 +89,7 @@ class NetworkingTestCase(testutils.ConnectingTestCase):
|
|||
self.assert_(isinstance(obj, ip.IPv6Network), repr(obj))
|
||||
self.assertEquals(obj, ip.ip_network('::ffff:102:300/128'))
|
||||
|
||||
@testutils.skip_if_crdb
|
||||
@testutils.skip_before_postgres(8, 2)
|
||||
def test_cidr_array_cast(self):
|
||||
cur = self.conn.cursor()
|
||||
|
|
|
@ -32,13 +32,14 @@ import psycopg2
|
|||
import psycopg2.extensions
|
||||
import unittest
|
||||
from .testutils import (decorate_all_tests, skip_if_tpc_disabled,
|
||||
skip_before_postgres, ConnectingTestCase, skip_if_green, slow)
|
||||
skip_before_postgres, ConnectingTestCase, skip_if_green, skip_if_crdb, slow)
|
||||
|
||||
|
||||
skip_if_no_lo = skip_before_postgres(8, 1,
|
||||
"large objects only supported from PG 8.1")
|
||||
|
||||
skip_lo_if_green = skip_if_green("libpq doesn't support LO in async mode")
|
||||
def skip_if_no_lo(f):
|
||||
f = skip_before_postgres(8, 1, "large objects only supported from PG 8.1")(f)
|
||||
f = skip_if_green("libpq doesn't support LO in async mode")(f)
|
||||
f = skip_if_crdb(f)
|
||||
return f
|
||||
|
||||
|
||||
class LargeObjectTestCase(ConnectingTestCase):
|
||||
|
@ -67,7 +68,6 @@ class LargeObjectTestCase(ConnectingTestCase):
|
|||
|
||||
|
||||
@skip_if_no_lo
|
||||
@skip_lo_if_green
|
||||
class LargeObjectTests(LargeObjectTestCase):
|
||||
def test_create(self):
|
||||
lo = self.conn.lobject()
|
||||
|
@ -413,7 +413,6 @@ def skip_if_no_truncate(f):
|
|||
|
||||
|
||||
@skip_if_no_lo
|
||||
@skip_lo_if_green
|
||||
@skip_if_no_truncate
|
||||
class LargeObjectTruncateTests(LargeObjectTestCase):
|
||||
def test_truncate(self):
|
||||
|
@ -478,7 +477,6 @@ def skip_if_no_lo64(f):
|
|||
|
||||
|
||||
@skip_if_no_lo
|
||||
@skip_lo_if_green
|
||||
@skip_if_no_truncate
|
||||
@skip_if_no_lo64
|
||||
class LargeObject64Tests(LargeObjectTestCase):
|
||||
|
@ -506,7 +504,6 @@ def skip_if_lo64(f):
|
|||
|
||||
|
||||
@skip_if_no_lo
|
||||
@skip_lo_if_green
|
||||
@skip_if_no_truncate
|
||||
@skip_if_lo64
|
||||
class LargeObjectNot64Tests(LargeObjectTestCase):
|
||||
|
|
|
@ -32,7 +32,7 @@ from weakref import ref
|
|||
|
||||
import unittest
|
||||
from .testutils import (skip_before_postgres,
|
||||
ConnectingTestCase, skip_copy_if_green, slow, StringIO)
|
||||
ConnectingTestCase, skip_copy_if_green, skip_if_crdb, slow, StringIO)
|
||||
|
||||
import psycopg2
|
||||
|
||||
|
@ -216,6 +216,7 @@ class ExceptionsTestCase(ConnectingTestCase):
|
|||
gc.collect()
|
||||
assert(w() is None)
|
||||
|
||||
@skip_if_crdb
|
||||
@skip_copy_if_green
|
||||
def test_diagnostics_copy(self):
|
||||
f = StringIO()
|
||||
|
@ -244,6 +245,7 @@ class ExceptionsTestCase(ConnectingTestCase):
|
|||
self.assertEqual(diag1.sqlstate, '42601')
|
||||
self.assertEqual(diag2.sqlstate, '42P01')
|
||||
|
||||
@skip_if_crdb
|
||||
def test_diagnostics_from_commit(self):
|
||||
cur = self.conn.cursor()
|
||||
cur.execute("""
|
||||
|
@ -259,6 +261,7 @@ class ExceptionsTestCase(ConnectingTestCase):
|
|||
e = exc
|
||||
self.assertEqual(e.diag.sqlstate, '23503')
|
||||
|
||||
@skip_if_crdb
|
||||
@skip_before_postgres(9, 3)
|
||||
def test_9_3_diagnostics(self):
|
||||
cur = self.conn.cursor()
|
||||
|
@ -299,6 +302,7 @@ class ExceptionsTestCase(ConnectingTestCase):
|
|||
self.assertEqual(e.pgcode, e1.pgcode)
|
||||
self.assert_(e1.cursor is None)
|
||||
|
||||
@skip_if_crdb
|
||||
def test_pickle_connection_error(self):
|
||||
# segfaults on psycopg 2.5.1 - see ticket #170
|
||||
try:
|
||||
|
|
|
@ -29,7 +29,7 @@ from collections import deque
|
|||
import psycopg2
|
||||
from psycopg2 import extensions
|
||||
from psycopg2.extensions import Notify
|
||||
from .testutils import ConnectingTestCase, slow
|
||||
from .testutils import ConnectingTestCase, skip_if_crdb, slow
|
||||
from .testconfig import dsn
|
||||
|
||||
import sys
|
||||
|
@ -38,6 +38,7 @@ import select
|
|||
from subprocess import Popen, PIPE
|
||||
|
||||
|
||||
@skip_if_crdb
|
||||
class NotifiesTests(ConnectingTestCase):
|
||||
|
||||
def autocommit(self, conn):
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
from . import testutils
|
||||
import unittest
|
||||
from .testutils import ConnectingTestCase, unichr, PY2
|
||||
from .testutils import ConnectingTestCase, skip_if_crdb, unichr, PY2
|
||||
|
||||
import psycopg2
|
||||
import psycopg2.extensions
|
||||
|
@ -121,6 +121,7 @@ class QuotingTestCase(ConnectingTestCase):
|
|||
self.assertEqual(res, data)
|
||||
self.assert_(not self.conn.notices)
|
||||
|
||||
@skip_if_crdb
|
||||
def test_latin1(self):
|
||||
self.conn.set_client_encoding('LATIN1')
|
||||
curs = self.conn.cursor()
|
||||
|
@ -146,6 +147,7 @@ class QuotingTestCase(ConnectingTestCase):
|
|||
self.assertEqual(res, data)
|
||||
self.assert_(not self.conn.notices)
|
||||
|
||||
@skip_if_crdb
|
||||
def test_koi8(self):
|
||||
self.conn.set_client_encoding('KOI8')
|
||||
curs = self.conn.cursor()
|
||||
|
|
|
@ -26,7 +26,8 @@
|
|||
import datetime as dt
|
||||
import unittest
|
||||
from .testutils import (
|
||||
ConnectingTestCase, skip_before_postgres, skip_copy_if_green, StringIO)
|
||||
ConnectingTestCase, skip_before_postgres, skip_copy_if_green, StringIO,
|
||||
skip_if_crdb)
|
||||
|
||||
import psycopg2
|
||||
from psycopg2 import sql
|
||||
|
@ -151,6 +152,7 @@ class SqlFormatTests(ConnectingTestCase):
|
|||
self.assertEqual(cur.fetchall(),
|
||||
[(10, 'a', 'b', 'c'), (20, 'd', 'e', 'f')])
|
||||
|
||||
@skip_if_crdb
|
||||
@skip_copy_if_green
|
||||
@skip_before_postgres(8, 2)
|
||||
def test_copy(self):
|
||||
|
|
|
@ -26,18 +26,22 @@
|
|||
import threading
|
||||
import unittest
|
||||
from .testutils import ConnectingTestCase, skip_before_postgres, slow
|
||||
from .testutils import crdb_version, skip_if_crdb
|
||||
|
||||
import psycopg2
|
||||
from psycopg2.extensions import (
|
||||
ISOLATION_LEVEL_SERIALIZABLE, STATUS_BEGIN, STATUS_READY)
|
||||
|
||||
|
||||
@skip_if_crdb
|
||||
class TransactionTests(ConnectingTestCase):
|
||||
|
||||
def setUp(self):
|
||||
ConnectingTestCase.setUp(self)
|
||||
self.conn.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE)
|
||||
curs = self.conn.cursor()
|
||||
if crdb_version(self.conn) is not None:
|
||||
self.skipTest("features not supported on CockroachDB")
|
||||
curs.execute('''
|
||||
CREATE TEMPORARY TABLE table1 (
|
||||
id int PRIMARY KEY
|
||||
|
@ -92,6 +96,7 @@ class TransactionTests(ConnectingTestCase):
|
|||
self.assertEqual(curs.fetchone()[0], 1)
|
||||
|
||||
|
||||
@skip_if_crdb
|
||||
class DeadlockSerializationTests(ConnectingTestCase):
|
||||
"""Test deadlock and serialization failure errors."""
|
||||
|
||||
|
@ -102,6 +107,8 @@ class DeadlockSerializationTests(ConnectingTestCase):
|
|||
|
||||
def setUp(self):
|
||||
ConnectingTestCase.setUp(self)
|
||||
if crdb_version(self.conn) is not None:
|
||||
self.skipTest("features not supported on CockroachDB")
|
||||
|
||||
curs = self.conn.cursor()
|
||||
# Drop table if it already exists
|
||||
|
|
|
@ -27,7 +27,7 @@ import psycopg2
|
|||
import psycopg2.extensions as ext
|
||||
|
||||
import unittest
|
||||
from .testutils import ConnectingTestCase, skip_before_postgres
|
||||
from .testutils import ConnectingTestCase, skip_before_postgres, skip_if_crdb
|
||||
|
||||
|
||||
class WithTestCase(ConnectingTestCase):
|
||||
|
@ -203,6 +203,7 @@ class WithCursorTestCase(WithTestCase):
|
|||
self.assert_(curs.closed)
|
||||
self.assert_(closes)
|
||||
|
||||
@skip_if_crdb
|
||||
def test_exception_swallow(self):
|
||||
# bug #262: __exit__ calls cur.close() that hides the exception
|
||||
# with another error.
|
||||
|
@ -216,6 +217,7 @@ class WithCursorTestCase(WithTestCase):
|
|||
else:
|
||||
self.fail("where is my exception?")
|
||||
|
||||
@skip_if_crdb
|
||||
@skip_before_postgres(8, 2)
|
||||
def test_named_with_noop(self):
|
||||
with self.conn.cursor('named'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user