From f1319f5f0777efa18b92bbf860648fc10ef9a066 Mon Sep 17 00:00:00 2001 From: FliegendeWurst Date: Sun, 2 Feb 2025 11:26:58 +0100 Subject: [PATCH] python310Packages.pyasynchat: fix tests Used methods added in Python 3.11. --- .../python-modules/pyasynchat/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/development/python-modules/pyasynchat/default.nix b/pkgs/development/python-modules/pyasynchat/default.nix index 2472b2ef68b6..b8f7cd764133 100644 --- a/pkgs/development/python-modules/pyasynchat/default.nix +++ b/pkgs/development/python-modules/pyasynchat/default.nix @@ -5,6 +5,7 @@ setuptools, pyasyncore, pytestCheckHook, + pythonOlder, }: buildPythonPackage rec { @@ -29,6 +30,17 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook ]; + preCheck = + if (pythonOlder "3.11") then + '' + substituteInPlace tests/test_asynchat.py \ + --replace-fail "asynchat = warnings_helper.import_deprecated('asynchat')" 'import asynchat' \ + --replace-fail "asyncore = warnings_helper.import_deprecated('asyncore')" 'import asyncore' \ + --replace-fail 'support.requires_working_socket(module=True)' "" + '' + else + null; + pythonImportsCheck = [ "asynchat" ];