+import sys
import time
import pytest
import logging
from dataclasses import dataclass
import psycopg
-from psycopg import Notify, errors as e
+from psycopg import Notify, pq, errors as e
from psycopg.rows import tuple_row
from psycopg.conninfo import conninfo_to_dict, make_conninfo
conn.cursor()
+# TODO: the INERROR started failing in the C implementation in Python 3.12a7
+# compiled with Cython-3.0.0b3, not before.
+@pytest.mark.xfail(
+ (pq.__impl__ in ("c", "binary") and sys.version_info[:2] == (3, 12)),
+ reason="Something with Exceptions, C, Python 3.12",
+)
def test_connection_warn_close(conn_cls, dsn, recwarn):
conn = conn_cls.connect(dsn)
conn.close()
conn = conn_cls.connect(dsn)
try:
conn.execute("select wat")
- except Exception:
+ except psycopg.ProgrammingError:
pass
del conn
+ gc_collect()
assert "INERROR" in str(recwarn.pop(ResourceWarning).message)
with conn_cls.connect(dsn) as conn:
+import sys
import pickle
from typing import List
from weakref import ref
@pytest.mark.slow
+@pytest.mark.xfail(
+ (pq.__impl__ in ("c", "binary") and sys.version_info[:2] == (3, 12)),
+ reason="Something with Exceptions, C, Python 3.12",
+)
def test_diag_survives_cursor(conn):
cur = conn.cursor()
with pytest.raises(e.Error) as exc: