Skip to content

Commit

Permalink
test(crdb): skip tests with arrays of json[b]
Browse files Browse the repository at this point in the history
Not supported by CRDB: cockroachdb/cockroach#23468
  • Loading branch information
dvarrazzo committed Jun 7, 2022
1 parent 754bb5a commit 775e865
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/fix_crdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def crdb_scs_off(*args):
"hstore": 41284,
"infinity date": 41564,
"interval style": 35807,
"json array": 23468,
"large objects": 243,
"negative interval": 81577,
"nested array": 32552,
Expand Down
6 changes: 6 additions & 0 deletions tests/fix_faker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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

Expand Down Expand Up @@ -485,6 +486,11 @@ def schema_list(self, cls):
# 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
Expand Down
2 changes: 2 additions & 0 deletions tests/types/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 775e865

Please sign in to comment.