From 917a0d2bffaf57913f4e2415ca2a592ce9280a56 Mon Sep 17 00:00:00 2001 From: Jonas Heinrich Date: Sat, 6 Aug 2022 09:15:39 +0200 Subject: [PATCH] python310Packages.clustershell: Fix tests --- .../python-modules/clustershell/default.nix | 55 ++++++++++++------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/pkgs/development/python-modules/clustershell/default.nix b/pkgs/development/python-modules/clustershell/default.nix index 9e6d383db203..890c20b0d25a 100644 --- a/pkgs/development/python-modules/clustershell/default.nix +++ b/pkgs/development/python-modules/clustershell/default.nix @@ -1,5 +1,13 @@ -{ stdenv, lib, buildPythonPackage, fetchPypi, pyyaml, openssh -, nose, bc, hostname, coreutils, bash, gnused +{ stdenv +, lib +, buildPythonPackage +, fetchPypi +, pyyaml +, openssh +, nose +, bc +, hostname +, bash }: buildPythonPackage rec { @@ -11,8 +19,6 @@ buildPythonPackage rec { sha256 = "ff6fba688a06e5e577315d899f0dab3f4fe479cef99d444a4e651af577b7d081"; }; - propagatedBuildInputs = [ pyyaml ]; - postPatch = '' substituteInPlace lib/ClusterShell/Worker/Ssh.py \ --replace '"ssh"' '"${openssh}/bin/ssh"' \ @@ -20,29 +26,40 @@ buildPythonPackage rec { substituteInPlace lib/ClusterShell/Worker/fastsubprocess.py \ --replace '"/bin/sh"' '"${bash}/bin/sh"' + + for f in tests/*; do + substituteInPlace $f \ + --replace '/bin/hostname' '${hostname}/bin/hostname' \ + --replace '/bin/sleep' 'sleep' \ + --replace '/bin/echo' 'echo' \ + --replace '/bin/uname' 'uname' \ + --replace '/bin/false' 'false' \ + --replace '/bin/true' 'true' \ + --replace '/usr/bin/printf' 'printf' + done + + # Fix warnings + substituteInPlace lib/ClusterShell/Task.py \ + --replace "notifyAll" "notify_all" + substituteInPlace tests/TaskPortTest.py lib/ClusterShell/Task.py \ + --replace "currentThread" "current_thread" ''; - checkInputs = [ nose bc hostname coreutils gnused ]; + propagatedBuildInputs = [ pyyaml ]; + + checkInputs = [ + bc + hostname + nose + ]; + + pythonImportsCheck = [ "ClusterShell" ]; # Many tests want to open network connections # https://github.com/cea-hpc/clustershell#test-suite # # Several tests fail on Darwin checkPhase = '' - for f in tests/*; do - substituteInPlace $f \ - --replace '/bin/hostname' '${hostname}/bin/hostname' \ - --replace '/bin/sleep' '${coreutils}/bin/sleep' \ - --replace '"sleep' '"${coreutils}/bin/sleep' \ - --replace '/bin/echo' '${coreutils}/bin/echo' \ - --replace '/bin/uname' '${coreutils}/bin/uname' \ - --replace '/bin/false' '${coreutils}/bin/false' \ - --replace '/bin/true' '${coreutils}/bin/true' \ - --replace '/usr/bin/printf' '${coreutils}/bin/printf' \ - --replace '"sed' '"${gnused}/bin/sed' \ - --replace ' sed ' ' ${gnused}/bin/sed ' - done - rm tests/CLIClushTest.py rm tests/TreeWorkerTest.py rm tests/TaskDistantMixin.py