]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): test severity_nonlocalized on CRDB versions supporting it
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:38:11 +0000 (12:38 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 12 Jul 2022 11:58:34 +0000 (12:58 +0100)
tests/fix_crdb.py
tests/test_errors.py

index 27144774d5026874a5920b715a054288de1f4cc5..b90c642293311878cab1f2a60034f00c8c3f1775 100644 (file)
@@ -126,4 +126,5 @@ _crdb_reason_version = {
     "backend pid": "skip < 22",
     "cancel": "skip < 22",
     "server-side cursor": "skip < 22.1.3",
+    "severity_nonlocalized": "skip < 22.1.3",
 }
index 3aced3cd08aa1f03f31c6c086ee40d5b98abcbba..23ad314fdb47b9b846f0c432d78e57d518b621a5 100644 (file)
@@ -12,6 +12,7 @@ from .utils import eur, gc_collect
 from .fix_crdb import is_crdb
 
 
+@pytest.mark.crdb_skip("severity_nonlocalized")
 def test_error_diag(conn):
     cur = conn.cursor()
     with pytest.raises(e.DatabaseError) as excinfo:
@@ -20,8 +21,7 @@ def test_error_diag(conn):
     exc = excinfo.value
     diag = exc.diag
     assert diag.sqlstate == "42P01"
-    # https://github.com/cockroachdb/cockroach/issues/81794
-    assert (diag.severity_nonlocalized or diag.severity) == "ERROR"
+    assert diag.severity_nonlocalized == "ERROR"
 
 
 def test_diag_all_attrs(pgconn):