about summary refs log tree commit diff
path: root/pkgs/development/python-modules/psycopg/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/psycopg/default.nix')
-rw-r--r--pkgs/development/python-modules/psycopg/default.nix130
1 files changed, 70 insertions, 60 deletions
diff --git a/pkgs/development/python-modules/psycopg/default.nix b/pkgs/development/python-modules/psycopg/default.nix
index 65d9e3523620..3338ad86ce2e 100644
--- a/pkgs/development/python-modules/psycopg/default.nix
+++ b/pkgs/development/python-modules/psycopg/default.nix
@@ -1,46 +1,47 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, fetchurl
-, pythonOlder
-, substituteAll
-
-# build
-, postgresql
-, setuptools
-
-# propagates
-, backports-zoneinfo
-, typing-extensions
-
-# psycopg-c
-, cython
-, tomli
-
-# docs
-, furo
-, shapely
-, sphinxHook
-, sphinx-autodoc-typehints
-
-# tests
-, anyio
-, pproxy
-, pytest-randomly
-, pytestCheckHook
-, postgresqlTestHook
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  fetchFromGitHub,
+  fetchurl,
+  pythonOlder,
+  substituteAll,
+
+  # build
+  postgresql,
+  setuptools,
+
+  # propagates
+  backports-zoneinfo,
+  typing-extensions,
+
+  # psycopg-c
+  cython,
+  tomli,
+
+  # docs
+  furo,
+  shapely,
+  sphinxHook,
+  sphinx-autodoc-typehints,
+
+  # tests
+  anyio,
+  pproxy,
+  pytest-randomly,
+  pytestCheckHook,
+  postgresqlTestHook,
 }:
 
 let
   pname = "psycopg";
-  version = "3.1.17";
+  version = "3.2.3";
 
   src = fetchFromGitHub {
     owner = "psycopg";
     repo = pname;
     rev = "refs/tags/${version}";
-    hash = "sha256-Paq4Wkvv6d6+fNcvRO/yfj7OWCMygqccKIdfsohHUMM=";
+    hash = "sha256-vcUZvQeD5MnEM02phk73I9dpf0Eug95V7Rspi0s6S2M=";
   };
 
   patches = [
@@ -73,11 +74,16 @@ let
 
     nativeBuildInputs = [
       cython
+      # needed to find pg_config with strictDeps
       postgresql
       setuptools
       tomli
     ];
 
+    buildInputs = [
+      postgresql
+    ];
+
     # tested in psycopg
     doCheck = false;
 
@@ -99,9 +105,7 @@ let
       cd psycopg_pool
     '';
 
-    propagatedBuildInputs = [
-      typing-extensions
-    ];
+    propagatedBuildInputs = [ typing-extensions ];
 
     # tested in psycopg
     doCheck = false;
@@ -110,7 +114,6 @@ let
       description = "Connection Pool for Psycopg";
     };
   };
-
 in
 
 buildPythonPackage rec {
@@ -150,9 +153,7 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     psycopg-c
     typing-extensions
-  ] ++ lib.optionals (pythonOlder "3.9") [
-    backports-zoneinfo
-  ];
+  ] ++ lib.optionals (pythonOlder "3.9") [ backports-zoneinfo ];
 
   pythonImportsCheck = [
     "psycopg"
@@ -160,21 +161,22 @@ buildPythonPackage rec {
     "psycopg_pool"
   ];
 
-  passthru.optional-dependencies = {
+  optional-dependencies = {
     c = [ psycopg-c ];
     pool = [ psycopg-pool ];
   };
 
-  nativeCheckInputs = [
-    anyio
-    pproxy
-    pytest-randomly
-    pytestCheckHook
-    postgresql
-  ]
-  ++ lib.optional (stdenv.isLinux) postgresqlTestHook
-  ++ passthru.optional-dependencies.c
-  ++ passthru.optional-dependencies.pool;
+  nativeCheckInputs =
+    [
+      anyio
+      pproxy
+      pytest-randomly
+      pytestCheckHook
+      postgresql
+    ]
+    ++ lib.optional (stdenv.hostPlatform.isLinux) postgresqlTestHook
+    ++ optional-dependencies.c
+    ++ optional-dependencies.pool;
 
   env = {
     postgresqlEnableTCP = 1;
@@ -182,11 +184,13 @@ buildPythonPackage rec {
     PGDATABASE = "psycopg";
   };
 
-  preCheck = ''
-    cd ..
-  '' + lib.optionalString (stdenv.isLinux) ''
-    export PSYCOPG_TEST_DSN="host=/build/run/postgresql user=$PGUSER"
-  '';
+  preCheck =
+    ''
+      cd ..
+    ''
+    + lib.optionalString (stdenv.hostPlatform.isLinux) ''
+      export PSYCOPG_TEST_DSN="host=/build/run/postgresql user=$PGUSER"
+    '';
 
   disabledTests = [
     # don't depend on mypy for tests
@@ -201,13 +205,19 @@ buildPythonPackage rec {
     # Mypy typing test
     "tests/test_typing.py"
     "tests/crdb/test_typing.py"
+    # https://github.com/psycopg/psycopg/pull/915
+    "tests/test_notify.py"
+    "tests/test_notify_async.py"
   ];
 
   pytestFlagsArray = [
-    "-o" "cache_dir=$TMPDIR"
-    "-m" "'not refcount and not timing'"
+    "-o"
+    "cache_dir=$TMPDIR"
+    "-m"
+    "'not refcount and not timing and not flakey'"
     # pytest.PytestRemovedIn9Warning: Marks applied to fixtures have no effect
-    "-W" "ignore::pytest.PytestRemovedIn9Warning"
+    "-W"
+    "ignore::pytest.PytestRemovedIn9Warning"
   ];
 
   postCheck = ''