]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): skip tests with arrays of json[b]
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 6 Jun 2022 22:50:34 +0000 (00:50 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:58:34 +0000 (12:58 +0100)
Not supported by CRDB: https://github.com/cockroachdb/cockroach/issues/23468

tests/fix_crdb.py
tests/fix_faker.py
tests/types/test_json.py

index 5cf9d087a09d63ead2cc23695eec7f792a6bf6f8..8a13c28c9d2408f62197602cbb571d41ae904a64 100644 (file)
@@ -101,6 +101,7 @@ _crdb_reasons = {
     "hstore": 41284,
     "infinity date": 41564,
     "interval style": 35807,
+    "json array": 23468,
     "large objects": 243,
     "negative interval": 81577,
     "nested array": 32552,
index b076b374d37a04bfb271d8fa9f91e75025fcef82..0c263bbb0675e00f84efcd88674bf428fbab5b20 100644 (file)
@@ -15,6 +15,7 @@ from psycopg import sql
 from psycopg.adapt import PyFormat
 from psycopg._compat import Deque
 from psycopg.types.range import Range
+from psycopg.types.json import Json, Jsonb
 from psycopg.types.numeric import Int4, Int8
 from psycopg.types.multirange import Multirange
 
@@ -485,6 +486,11 @@ class Faker:
                 # There may be rounding errors or problems with inf.
                 continue
 
+            # CRDB doesn't support arrays of json
+            # https://github.com/cockroachdb/cockroach/issues/23468
+            if self.conn.info.vendor == "CockroachDB" and scls in (Json, Jsonb):
+                continue
+
             schema = self.make_schema(scls)
             if schema is not None:
                 break
index a23ec0ad7651154577a7aa769476d67497228355..9e707e93ff9c10c6b5204515086b89faa3cd610a 100644 (file)
@@ -47,6 +47,7 @@ def test_dump(conn, val, wrapper, fmt_in):
     assert cur.fetchone()[0] is True
 
 
+@pytest.mark.crdb("skip", reason="json array")
 @pytest.mark.parametrize("val", samples)
 @pytest.mark.parametrize("wrapper", ["Json", "Jsonb"])
 @pytest.mark.parametrize("fmt_in", PyFormat)
@@ -70,6 +71,7 @@ def test_load(conn, val, jtype, fmt_out):
     assert cur.fetchone()[0] == json.loads(val)
 
 
+@pytest.mark.crdb("skip", reason="json array")
 @pytest.mark.parametrize("val", samples)
 @pytest.mark.parametrize("jtype", ["json", "jsonb"])
 @pytest.mark.parametrize("fmt_out", pq.Format)