diff --git a/pkgs/development/python-modules/psycopg/ctypes.patch b/pkgs/development/python-modules/psycopg/ctypes.patch index a76d38f85e80..d2b0842b44b4 100644 --- a/pkgs/development/python-modules/psycopg/ctypes.patch +++ b/pkgs/development/python-modules/psycopg/ctypes.patch @@ -1,5 +1,5 @@ diff --git a/psycopg/psycopg/pq/_pq_ctypes.py b/psycopg/psycopg/pq/_pq_ctypes.py -index 4f9d00fb..24b90ef6 100644 +index 9ca1d129..02929ab6 100644 --- a/psycopg/psycopg/pq/_pq_ctypes.py +++ b/psycopg/psycopg/pq/_pq_ctypes.py @@ -11,14 +11,10 @@ from ctypes import Structure, CFUNCTYPE, POINTER @@ -30,17 +30,26 @@ index 4f9d00fb..24b90ef6 100644 fdopen = libc.fdopen fdopen.argtypes = (c_int, c_char_p) diff --git a/tests/fix_pq.py b/tests/fix_pq.py -index 6811a26c..c1829c82 100644 +index 917dfc91..505f2d65 100644 --- a/tests/fix_pq.py +++ b/tests/fix_pq.py -@@ -51,9 +51,7 @@ def libpq(): - from psycopg.pq.misc import find_libpq_full_path - - # Not available when testing the binary package +@@ -47,18 +47,7 @@ def pytest_runtest_setup(item): + @pytest.fixture + def libpq(): + """Return a ctypes wrapper to access the libpq.""" +- try: +- from psycopg.pq.misc import find_libpq_full_path +- +- # Not available when testing the binary package - libname = find_libpq_full_path() - assert libname, "libpq libname not found" -- return ctypes.pydll.LoadLibrary(libname) -+ return ctypes.pydll.LoadLibrary("@libpq@") - except Exception as e: - if pq.__impl__ == "binary": - pytest.skip(f"can't load libpq for testing: {e}") +- return ctypes.cdll.LoadLibrary(libname) +- except Exception as e: +- if pq.__impl__ == "binary": +- pytest.skip(f"can't load libpq for testing: {e}") +- else: +- raise ++ return ctypes.cdll.LoadLibrary("@libpq@") + + + @pytest.fixture diff --git a/pkgs/development/python-modules/psycopg/default.nix b/pkgs/development/python-modules/psycopg/default.nix index b73c74ca0ae3..d66f21ca2679 100644 --- a/pkgs/development/python-modules/psycopg/default.nix +++ b/pkgs/development/python-modules/psycopg/default.nix @@ -35,13 +35,13 @@ let pname = "psycopg"; - version = "3.1.13"; + version = "3.1.14"; src = fetchFromGitHub { owner = "psycopg"; repo = pname; rev = "refs/tags/${version}"; - hash = "sha256-N+x8RErlId1uBgXZjBBjtPxqJXGuXZEl78DKVKjhy9w="; + hash = "sha256-zocRBnrQoJDWI4qhxDnxxIeiLdaWolvsujqfHBYQc/A="; }; patches = [ @@ -52,11 +52,9 @@ let }) (fetchpatch { - # fix environment variables leaking into test environment - # https://github.com/psycopg/psycopg/pull/683 - # https://github.com/psycopg/psycopg/issues/681 - url = "https://github.com/psycopg/psycopg/commit/f060855aa6126e811de243c7213d2caff9c88123.patch"; - hash = "sha256-QsFxK8Qasw9kbNCUUCqbOHaf53kT5NONlr28vGoPda0="; + # add fixture to mark flaky ref count tests + url = "https://github.com/psycopg/psycopg/commit/70ef364324ba3448ef9ac0e29329c9d802380e4b.patch"; + hash = "sha256-8PlrBcIumlxFjNXCAfm4NpSIxAnvLR8TopHzneJyzf0="; }) ]; @@ -214,7 +212,7 @@ buildPythonPackage rec { pytestFlagsArray = [ "-o" "cache_dir=$TMPDIR" - "-m" "'not timing'" + "-m" "'not refcount and not timing'" ]; postCheck = ''