From: Daniele Varrazzo Date: Mon, 23 May 2022 00:42:15 +0000 (+0200) Subject: test(crdb): skip tests for unsupported types X-Git-Tag: 3.1~49^2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9bd7014091bbd298b6d7a55dbfeaa128130d2b2;p=thirdparty%2Fpsycopg.git test(crdb): skip tests for unsupported types --- diff --git a/tests/types/test_composite.py b/tests/types/test_composite.py index 1ca4a6220..8e05f7717 100644 --- a/tests/types/test_composite.py +++ b/tests/types/test_composite.py @@ -8,6 +8,10 @@ from psycopg.types.composite import CompositeInfo, register_composite from psycopg.types.composite import TupleDumper, TupleBinaryDumper from ..utils import eur +from ..fix_crdb import is_crdb, crdb_skip_message + + +pytestmark = pytest.mark.crdb("skip", reason="composite") tests_str = [ ("", ()), @@ -112,6 +116,8 @@ def test_load_record_binary(conn, want, rec): @pytest.fixture(scope="session") def testcomp(svcconn): + if is_crdb(svcconn): + pytest.skip(crdb_skip_message("composite")) cur = svcconn.cursor() cur.execute( """ diff --git a/tests/types/test_hstore.py b/tests/types/test_hstore.py index ac9d87c24..1eac009ff 100644 --- a/tests/types/test_hstore.py +++ b/tests/types/test_hstore.py @@ -4,6 +4,8 @@ import psycopg from psycopg.types import TypeInfo from psycopg.types.hstore import HstoreLoader, register_hstore +pytestmark = pytest.mark.crdb("skip", reason="hstore") + @pytest.mark.parametrize( "s, d", diff --git a/tests/types/test_multirange.py b/tests/types/test_multirange.py index 5dd9b0990..4e5ac9870 100644 --- a/tests/types/test_multirange.py +++ b/tests/types/test_multirange.py @@ -15,7 +15,10 @@ from psycopg.types.multirange import register_multirange from ..utils import eur from .test_range import create_test_range -pytestmark = pytest.mark.pg(">= 14") +pytestmark = [ + pytest.mark.pg(">= 14"), + pytest.mark.crdb("skip", reason="range"), +] class TestMultirangeObject: diff --git a/tests/types/test_net.py b/tests/types/test_net.py index c1b29d7f9..252e0065d 100644 --- a/tests/types/test_net.py +++ b/tests/types/test_net.py @@ -6,6 +6,8 @@ from psycopg import pq from psycopg import sql from psycopg.adapt import PyFormat +crdb_skip_cidr = pytest.mark.crdb("skip", reason="cidr") + @pytest.mark.parametrize("fmt_in", PyFormat) @pytest.mark.parametrize("val", ["192.168.0.1", "2001:db8::"]) @@ -37,6 +39,7 @@ def test_interface_dump(conn, fmt_in, val): assert cur.fetchone()[0] is True +@crdb_skip_cidr @pytest.mark.parametrize("fmt_in", PyFormat) @pytest.mark.parametrize("val", ["127.0.0.0/24", "::ffff:102:300/128"]) def test_network_dump(conn, fmt_in, val): @@ -50,6 +53,7 @@ def test_network_dump(conn, fmt_in, val): assert cur.fetchone()[0] is True +@crdb_skip_cidr @pytest.mark.parametrize("fmt_in", PyFormat) def test_network_mixed_size_array(conn, fmt_in): val = [ @@ -62,6 +66,7 @@ def test_network_mixed_size_array(conn, fmt_in): assert val == got +@pytest.mark.crdb("skip", reason="copy") @pytest.mark.parametrize("fmt_out", pq.Format) @pytest.mark.parametrize("val", ["127.0.0.1/32", "::ffff:102:300/128"]) def test_inet_load_address(conn, fmt_out, val): @@ -84,6 +89,7 @@ def test_inet_load_address(conn, fmt_out, val): assert got == addr +@pytest.mark.crdb("skip", reason="copy") @pytest.mark.parametrize("fmt_out", pq.Format) @pytest.mark.parametrize("val", ["127.0.0.1/24", "::ffff:102:300/127"]) def test_inet_load_network(conn, fmt_out, val): @@ -106,6 +112,7 @@ def test_inet_load_network(conn, fmt_out, val): assert got == pyval +@crdb_skip_cidr @pytest.mark.parametrize("fmt_out", pq.Format) @pytest.mark.parametrize("val", ["127.0.0.0/24", "::ffff:102:300/128"]) def test_cidr_load(conn, fmt_out, val): diff --git a/tests/types/test_range.py b/tests/types/test_range.py index 6ab76280a..78e99c1d2 100644 --- a/tests/types/test_range.py +++ b/tests/types/test_range.py @@ -11,6 +11,9 @@ from psycopg.types import range as range_module from psycopg.types.range import Range, RangeInfo, register_range from ..utils import eur +from ..fix_crdb import is_crdb, crdb_skip_message + +pytestmark = pytest.mark.crdb("skip", reason="range") type2sub = { "int4range": "int4", @@ -263,6 +266,9 @@ def testrange(svcconn): def create_test_range(conn): + if is_crdb(conn): + pytest.skip(crdb_skip_message("range")) + conn.execute( """ create schema if not exists testschema; diff --git a/tests/types/test_shapely.py b/tests/types/test_shapely.py index a460c483d..0f7007e2d 100644 --- a/tests/types/test_shapely.py +++ b/tests/types/test_shapely.py @@ -10,7 +10,10 @@ pytest.importorskip("shapely") from shapely.geometry import Point, Polygon, MultiPolygon # noqa: E402 from psycopg.types.shapely import register_shapely # noqa: E402 -pytestmark = [pytest.mark.postgis] +pytestmark = [ + pytest.mark.postgis, + pytest.mark.crdb("skip"), +] # real example, with CRS and "holes" MULTIPOLYGON_GEOJSON = """ diff --git a/tests/types/test_uuid.py b/tests/types/test_uuid.py index f79b0060d..14f8715b0 100644 --- a/tests/types/test_uuid.py +++ b/tests/types/test_uuid.py @@ -17,6 +17,7 @@ def test_uuid_dump(conn, fmt_in): assert cur.fetchone()[0] is True +@pytest.mark.crdb("skip", reason="copy") @pytest.mark.parametrize("fmt_out", pq.Format) def test_uuid_load(conn, fmt_out): cur = conn.cursor(binary=fmt_out)