Re: RFC: adding pytest as a supported test framework

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RFC: adding pytest as a supported test framework
Date: 2024-06-12 16:46:23
Message-ID: CA+mi_8Zj0gpzPKUEcEx2mPOAsm0zPvznhbcnQDA_eeHVnVqg9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 12 Jun 2024 at 18:08, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl> wrote:
>
> On Wed, 12 Jun 2024 at 17:50, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > The OAuth pytest suite makes extensive use of
> > > - psycopg, to easily drive libpq;
> >
> > That's probably not going to fly. It introduces painful circular dependencies
> > between building postgres (for libpq), building psycopg (requiring libpq) and
> > testing postgres (requiring psycopg).
>
> psycopg has a few implementations binary, c, & pure python. The pure
> python one can be linked to a specific libpq.so file at runtime[1]. As

This is true, but [citation needed] :D I assume the pointer wanted to
be https://www.psycopg.org/psycopg3/docs/api/pq.html#pq-impl

I see the following use cases and how I would use psycopg to implement them:

- by installing 'psycopg[binary]' you would get a binary bundle
shipping with a stable version of the libpq, so you can test the
database server regardless of libpq instabilities in the same
codebase.
- using the pure Python psycopg (enforced by exporting
'PSYCOPG_IMPL=python') you would use the libpq found on the
LD_LIBRARY_PATH, which can be useful to test regressions to the libpq
itself.
- if you want to test new libpq functions you can reach them in Python
by dynamic lookup. See [2] for an example of a function only available
from libpq v17.

[2]: https://github.com/psycopg/psycopg/blob/2bf7783d66ab239a2fa330a842fd461c4bb17c48/psycopg/psycopg/pq/_pq_ctypes.py#L564-L569

-- Daniele

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sushrut Shivaswamy 2024-06-12 16:56:30 Columnar format export in Postgres
Previous Message Daniel Gustafsson 2024-06-12 16:45:52 Re: RFC: adding pytest as a supported test framework