From 66d4106a41b82bbe32b2fce3d5883af1e9d0fd7a Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Wed, 3 May 2023 13:04:51 +0200 Subject: [PATCH] python310Packages.psycopg: Test against a live postgresql instance provided by postgresqlTestHook. Extends our test coverage on Linux from 250 to over 4000 tests, that run in a reasonable time. --- .../python-modules/psycopg/default.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/psycopg/default.nix b/pkgs/development/python-modules/psycopg/default.nix index f2678ab25d0f..a61468b5eaca 100644 --- a/pkgs/development/python-modules/psycopg/default.nix +++ b/pkgs/development/python-modules/psycopg/default.nix @@ -30,6 +30,7 @@ , pproxy , pytest-randomly , pytestCheckHook +, postgresqlTestHook }: let @@ -165,10 +166,6 @@ buildPythonPackage rec { pool = [ psycopg-pool ]; }; - preCheck = '' - cd .. - ''; - nativeCheckInputs = [ anyio pproxy @@ -176,9 +173,21 @@ buildPythonPackage rec { pytestCheckHook postgresql ] + ++ lib.optional (stdenv.isLinux) postgresqlTestHook ++ passthru.optional-dependencies.c ++ passthru.optional-dependencies.pool; + env = { + postgresqlEnableTCP = 1; + PGUSER = "psycopg"; + }; + + preCheck = '' + cd .. + '' + lib.optionalString (stdenv.isLinux) '' + export PSYCOPG_TEST_DSN="host=127.0.0.1 user=$PGUSER" + ''; + disabledTests = [ # don't depend on mypy for tests "test_version"