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.
This commit is contained in:
Martin Weinelt 2023-05-03 13:04:51 +02:00
parent 42d82719f3
commit 66d4106a41
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -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"