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.94.2) (envelope-from ) id 1sI5l5-00CyT5-7M for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Jun 2024 12:10:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sI5l2-000J1e-US for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Jun 2024 12:10:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sI5l2-000J11-JO for pgsql-hackers@lists.postgresql.org; Fri, 14 Jun 2024 12:10:17 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sI5l0-001dEA-KA for pgsql-hackers@postgresql.org; Fri, 14 Jun 2024 12:10:16 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-579fa270e53so3104402a12.3 for ; Fri, 14 Jun 2024 05:10:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718367014; x=1718971814; 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=qMDjBC1GY6S5xm4bT1m2TRXLX/qr3L3knpJWuxBOuOs=; b=J09/h7GH3k8W+9s8rTZmeiBCp3Oj962v4aTilmYQ0BSXNV+oxlb1DZ08Lyad7ZoyRd 4bDzqWd4y4LVFSW7TK9zA2cgoeHQUxq1/eecdyc7V6wJpnqYQ19EcdXqSUjef27Ri3ja 96q/Gsv3DBdUlnIwOHbmSZb4s0AxOI+a+XyFJjFy8mpwEPofyHvRn/iar8A4v1E+pSP1 eEjtRC4t/4XDm8PVbFk7psH6KlwY8F8vbfSda7PbrNVH0JnQfuVF1FgGrP5yGqzLSsu6 rMu4OgsMaHkuP2y2tS9YH1WcJxwhGbmyq0aucfZRsDQNFZzXsdnFQ3bmrp5v53uWOcPy TQgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718367014; x=1718971814; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qMDjBC1GY6S5xm4bT1m2TRXLX/qr3L3knpJWuxBOuOs=; b=Q/3cuCxIzBa/Dc8LrB4/EFe00nRGyXNJ1+xWhAj+SZBG34xUf8Nym6k9v9YOzHiNyl rnhGUBr+AB6t4mXuAHReUhSWQD5ImbD+rKvKCyt2rIwfngKGzLDZorIeeMZv8P2+iQ2f fwGxMWBVCJtmac0TfnXwBDn8sJOs3mwz6M2oYQEFlKov2a7K57TKALVqt2xVQOpGIluI b+OYBWE/pgW+Q8yByQYoQa4XDlGAHn59FyICf+DR+b7gATkDmrJVfusO6EH8GNIwqjZT WJg6UmhtZ9dPSHN+JZb/0dZLDzAk87tDFWlz2zKWLvu1ca5j52NoIG+/MV/bBkEdzpMe DpEg== X-Forwarded-Encrypted: i=1; AJvYcCWe1dLteYjnBF5sNLgvBxR8CKErIHdw+MXky8xaCtLmfIxeuzbZKap6O/DHk+/LcUNOR3Sbb/YpI3j1gvnDFqZY+ZjUR8P4QNBw+uJh X-Gm-Message-State: AOJu0YxA0NYN9IbPxjw7fW3Qm0shtOewYexDgCYFOGgQKbDtBUEfBPvi uWCLKmn/XI7t/Xx76GyAsBNqQ+rQh1o34wuxJInQbg5E8C9L/yBjXJogw0LkCxYGLdGhORYcCsO ngmoYbfDC97Urq7A31NXzm1r7tpo= X-Google-Smtp-Source: AGHT+IGYKjfHFEUZ69uRK9uLcrIkRlqwlMsXQuXE+ZAjXjrhti0aiRd/HnllyB5A7Lggi/dcPZzRKdS7hAfEYkl7GQo= X-Received: by 2002:a17:907:d40e:b0:a6f:6554:2a2a with SMTP id a640c23a62f3a-a6f65543361mr168507166b.72.1718367013376; Fri, 14 Jun 2024 05:10:13 -0700 (PDT) MIME-Version: 1.0 References: <20240610200411.byj6sv2vpgol6wcf@awork3.anarazel.de> <20240612155040.u6cvatdb5tiwcxci@awork3.anarazel.de> In-Reply-To: From: Robert Haas Date: Fri, 14 Jun 2024 08:10:01 -0400 Message-ID: Subject: Re: RFC: adding pytest as a supported test framework To: Jacob Champion Cc: Jelte Fennema-Nio , Daniel Gustafsson , Andres Freund , PostgreSQL Hackers 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 On Thu, Jun 13, 2024 at 8:12=E2=80=AFPM Jacob Champion wrote: > But also: do you have opinions on what to fill in as steps 2 > (something we have no ability to test today) and 3 (something we do > test today, but hate)? > > My vote for step 2 is "client and server separation", perhaps by > testing libpq fallback against a server that claims support for > different build-time options. I don't want to have a vote in step 3, > because part of that step is proving that this framework can provide > value for a part of the project I don't really know much about. I mean, both Perl and Python are Turing-complete. Anything you can do in one, you can do in the other, especially when you consider that we're not likely to accept too many dependencies on external Perl or Python modules. That's why I see this as nothing more or less than exercise in letting people use the programming language they prefer. We've talked about a libpq FFI interface, but it hasn't been done; now we're talking about maybe having a Python one. Perhaps we'll end up with both. Then you can imagine porting tests from one language to the other and the only difference is whether you'd rather have line noise before all of your variable names or semantically significant whitespace. I just don't believe in the idea that we're going to write one category of tests in one language and another category in another language. As soon as we open the door to Python tests, people are going to start writing the TAP tests that they would have written in Perl in Python instead. And if the test utilities that we have for Perl are not there for Python, then they'll either open code things for which they would have used a module, or they'll write a stripped-down version of the module that will then get built-up patch by patch until, 50 or 100 or 200 hours of committer-review later, it resembles the existing Perl module. And, if the committer pushes back and says, hey, why not write this test in Perl which already has all of this test infrastructure in place already, then the submitter will wander off muttering about how PostgreSQL committers are hidebound backward individuals who just try to ruin everybody's day. So as I see it, the only reasonable plan here if we want to introduce testing in Python (or C#, or Ruby, or Go, or JavaScript, or Lua, or LOLCODE) is to try to achieve a reasonable degree of parity between that language and Perl. Because then we can at least review the new infrastructure all at once, instead of incrementally spread across many patches written, reviewed, and committed by many different people. Now, I completely understand if you're not excited about getting sucked down that rabbit-hole, and maybe some other committer is going to see this differently than I do, and that's fine. But my view is that if you're not interested in doing all the work to let people do more or less the kind of stuff that they currently do in Perl in Python instead, then your alternative is to take the tests that you want to add and rewrite them in Perl. And I am fairly cetain that if you choose that option, it will save me, and a bunch of other committers, a whole lot of work, at least in the short term. If we add support for Python, we are going to end up having to do a lot of things twice for the next let's say ten to twenty years until somebody rewrites the remaining Perl tests in Python or whatever language is hot and cool by then. My opinion is that we need to be open to enduring that pain because we can't indefinitely hold our breath and insist on using obsolete tools for everything, but that doesn't mean that I don't think it will be painful. Consider the meson build system project. To get that committed, Andres had to make it do pretty much everything MSVC could do and mostly everything that configure could do, and the places where he didn't make it do everything configure could do remain sore spots that I, at least, am not happy about. And in that case, he also managed to get MSVC removed entirely, so that we do not have a larger number of build systems in total than we had before. Furthermore, the amount of code in buildsystem files (makefiles, meson.build) in a typical patch needing review is usually none or very little, whereas the amount of test code in a patch is sometimes quite large. I've come around to the belief that the meson work was worthwhile -- running tests is so much faster and nicer now -- but it was a ton of work to get done and impacted everyone in the development community, and I think the blast radius for this change is likely to be larger for the reasons suggested earlier in this paragraph. --=20 Robert Haas EDB: http://www.enterprisedb.com