Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWbJr-005WqJ-2b for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Dec 2025 14:19:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWbJp-007sqg-37 for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Dec 2025 14:18:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWbJp-007sqY-28 for pgsql-hackers@lists.postgresql.org; Fri, 19 Dec 2025 14:18:58 +0000 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vWbJo-001W3X-28 for pgsql-hackers@postgresql.org; Fri, 19 Dec 2025 14:18:57 +0000 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-b73a9592fb8so373810266b.1 for ; Fri, 19 Dec 2025 06:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766153935; x=1766758735; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cu7r7XxaeURU8Q7GWt4BcuzpPpL7Ydkw8I1n3qApD7k=; b=mp8tqRoZKwUt6lrCOAIXvQ3FVBbKybvez6GfOWi5Ditt/H9DL08TD0ZDQ3iJqV6PBN 4ATLk8/LOxYpwmWpNpI6faBelA1RykA0Cj5sF84+tdD3YteAsIOnoSFQOGwqub2W53zJ a6PLsLfjBBe9vSEmbWvKxWdhg5XWJNB99lehpkdJgDSH/Os5WMqmC1aPT1x91oNtS5Fk ILN61xi1ikS1z9fOxzuLMzOEGjTXoRBo/CI+cnbZODOFkpuk8YrsuMJZxh+xwV15vdiZ 0Pvy5SGE+UKestkheqquAWIDCtzckuIg7muA2/tnDWeNAzSUOzIpNtOMjQ+4FUjqg0RV A/3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766153935; x=1766758735; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cu7r7XxaeURU8Q7GWt4BcuzpPpL7Ydkw8I1n3qApD7k=; b=wn/h+2Lw2PDeNocmCmnZRy3c41RGGjJyKF7J6k+R8sR+u76SosvOk+/x1GjaUxmnFR LOMQQgGoFNXs8EB4W2BRAJBFKEgzAooiVYPHdkvgn8AJ74ZTbmUXGgDK4VVZIvFxzVW3 bUhNrHPjuuYmc4jZ6xwlt8/0xoklX24OPE0OEGVwfkcV01euwHQ024NnAMPoNtKxjq6y oXvP+aPgjN/ZoKGjphhrEvF27xL90sxpGeyhljx/Y+Hm8WA2jPoHTT9Qr2kEzj8PkEow TozplNx7+ud3R+5Bc4SfztrRLzXeAr96wg8+0p6tiUqinrQOSh9/xCz0Av4rIPZXoGHN Jllg== X-Forwarded-Encrypted: i=1; AJvYcCVpem1a9ARahO5vnvnJJAG8D4YDENP5+Kc0YLszksGRUIxSkf/otBCjP6TyHqQSDH2ZEXl8U+3jmOJJopn4@postgresql.org X-Gm-Message-State: AOJu0YxcEo6RK/biMOwtaB+FBpfLXLJAX35TafWKVAsEA68N/qiS+yaq uzlvR5oLm+xGyu2jrPPWkPFJPXzhQ+sICn5J7txPL6AZQRutJt1HztotB2LHa/uOcuNttJToObi wlgYK3LaJpt4Xwt/G4s1rr+0DB/BZdos= X-Gm-Gg: AY/fxX4+0AKVaQZa5kYKEwxuqBMrl+wKese793i1K9HiNjqZBVOq250oCgCQr99wY9X nAeJSL1/dIsl686hs9A6A0Ww4lsbRwE9VzE+W9ksIQd/3X+W8wNJi+wccUig5mmfYdf8bfduJlO I1rCOLSvL7QIPxFzojJ4dQmZb5sz0IwgoZz+A2gbOrvg/uFN11RGO50J61pr+VvQAESnnegdl6m yR/NVYrATXCyFfeo5rShATUtNOtCH1Sbzb4tQ2/PGbKneZ9xD8eK0P18ZVj4xYZmNu1CTQYSlmv yqgwvS3ziT7jS343a5jQLvUshX5fwIkLfsamYfNnVE+cXWJ+gI2yzRxMH0RwYr6QMpyaZ0U= X-Google-Smtp-Source: AGHT+IGtQprAzq4L4VgZx4By/QnScgL7EyxuSrLCc6ILv1NCWoEmz6H67si0mKj67MxuZWSNP5Y99+3yozS8f59f+M4= X-Received: by 2002:a17:907:70d7:b0:b80:1403:764c with SMTP id a640c23a62f3a-b80205e6bd3mr512263066b.24.1766153934600; Fri, 19 Dec 2025 06:18:54 -0800 (PST) MIME-Version: 1.0 References: <2302192.1718380169@sss.pgh.pa.us> In-Reply-To: From: Xuneng Zhou Date: Fri, 19 Dec 2025 22:18:41 +0800 X-Gm-Features: AQt7F2pHI515hSEZTvHtimfSz95xi1dnuJBqgHbibf-utyYYBS6CpkG1KmPQfrs Message-ID: Subject: Re: RFC: adding pytest as a supported test framework To: Jelte Fennema-Nio Cc: Andres Freund , Jacob Champion , PostgreSQL Hackers , Robert Haas , Daniel Gustafsson , Tom Lane , Peter Eisentraut , Nazir Bilal Yavuz Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Jelte, Thanks for working on this. I=E2=80=99ve done an initial review of patch 4 = and here are some comments below. 1) Test infra: tmp_check() fixture looks wrong / unused variable def tmp_check(tmp_path_factory): d =3D os.getenv("TESTDATADIR") if d: d =3D pathlib.Path(d) else: d =3D tmp_path_factory.mktemp("tmp_check") return tmp_path_factory.mktemp("check_tmp") You compute d then ignore it and always return a new temp dir "check_tmp". It should probably return d (or d / "check_tmp"). 2) PQexec NULL handling is missing + def exec(self, query: str): + ... + res =3D self._lib.PQexec(self._handle, query.encode()) + return self._stack.enter_context(PGresult(self._lib, res)) No NULL check. If PQexec returns NULL (OOM, connection lost), the PGresult wrapper will pass it to PQresultStatus etc., causing undefined behavior or crash. 3) array parsing may be too simple _parse_array() does inner.split(","). That will break for valid Postgres arrays containing: quoted elements with commas: {"a,b","c"} escapes / quotes: {"a\"b"} or {"a\\b"} nested arrays: {{1,2},{3,4}} Should we document the constraint here or implement a more complete state-machine? 4) Type conversion: timestamp/timestamptz conversion could be wrong datetime.datetime.fromisoformat for both timestamp and timestamptz. - timestamptz output formatting from Postgres is not always fromisoformat() friendly (can include timezone formats that differ). - fromisoformat() yields timezone-aware datetimes only if the string has an offset; but Postgres output depends on DateStyle and timezone settings. This could make tests brittle across environments. Should we use dateutil.parser (if allowed) or document that the server uses ISO settings for pytest. 5) Server init: pg_ctl init vs initdb In non-Windows branch: run(pg_ctl, "-D", datadir, "init") initdb seems to be a more common way here. 6) Logging config: log_connections =3D all seems wrong print("log_connections =3D all", file=3Df) I don't see an option "all" for this parameter https://postgresqlco.nf/doc/en/param/log_connections/ 7) UX: error message handling and query attachment raise_error() builds message with primary + optional Query: .... Should we include SQLSTATE and severity in the message string by default, because it helps when reading CI logs. -- Best, Xuneng