summary refs log tree commit diff
diff options
context:
space:
mode:
authorRok Garbas <rok@garbas.si>2016-11-26 00:34:41 +0100
committerRok Garbas <rok@garbas.si>2016-11-26 04:55:28 +0100
commitb09435ea51caaae1865e667aaa32f7cba4cc4ff2 (patch)
treeeea61bac97085fcbb3d914b65dd456a9e6f447fb
parentfdbf7dc8b38cd523804d342d2c153dfeb10cc83d (diff)
downloadnixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar.gz
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar.bz2
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar.lz
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar.xz
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.tar.zst
nixlib-b09435ea51caaae1865e667aaa32f7cba4cc4ff2.zip
pythonPackages.magic-wormhole: enable tests
-rw-r--r--pkgs/development/python-modules/magic-wormhole/default.nix32
-rw-r--r--pkgs/top-level/python-packages.nix4
2 files changed, 24 insertions, 12 deletions
diff --git a/pkgs/development/python-modules/magic-wormhole/default.nix b/pkgs/development/python-modules/magic-wormhole/default.nix
index 304476c26a8d..483e9aa3a3b9 100644
--- a/pkgs/development/python-modules/magic-wormhole/default.nix
+++ b/pkgs/development/python-modules/magic-wormhole/default.nix
@@ -1,7 +1,6 @@
-{ fetchurl, lib, buildPythonPackage, python, autobahn
-, cffi, click, hkdf, pynacl, spake2, tqdm }:
+{ stdenv, fetchurl, nettools, glibcLocales, pythonPackages }:
 
-buildPythonPackage rec {
+pythonPackages.buildPythonApplication rec {
   name = "magic-wormhole-${version}";
   version = "0.8.1";
 
@@ -9,18 +8,29 @@ buildPythonPackage rec {
     url = "mirror://pypi/m/magic-wormhole/${name}.tar.gz";
     sha256 = "1yh5nbhh9z1am2pqnb5qqyq1zjl1m7z6jnkmvry2q14qwspw9had";
   };
-  checkPhase = ''
-    ${python.interpreter} -m wormhole.test.run_trial wormhole
+
+  buildInputs = [ nettools glibcLocales ];
+  propagatedBuildInputs = with pythonPackages; [ autobahn cffi click hkdf pynacl spake2 tqdm ];
+
+  patchPhase = ''
+    sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
+    sed -i -e "s|if (os.path.dirname(os.path.abspath(wormhole))|if not os.path.abspath(wormhole).startswith('/nix/store') and (os.path.dirname(os.path.abspath(wormhole))|" src/wormhole/test/test_scripts.py
+    # XXX: disable one test due to warning:
+    # setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
+    sed -i -e "s|def test_text_subprocess|def skip_test_text_subprocess|" src/wormhole/test/test_scripts.py
   '';
 
-  # Several test failures, network related.
-  doCheck = false;
+  checkPhase = ''
+    export PATH="$PATH:$out/bin"
+    export LANG="en_US.UTF-8"
+    export LC_ALL="en_US.UTF-8"
+    ${pythonPackages.python.interpreter} -m wormhole.test.run_trial wormhole
+  '';
 
-  propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ];
-  meta = {
+  meta = with stdenv.lib; {
     description = "Securely transfer data between computers";
     homepage = "https://github.com/warner/magic-wormhole";
-    license = lib.licenses.mit;
-    maintainers = with lib.maintainers; [ asymmetric ];
+    license = licenses.mit;
+    maintainers = with maintainers; [ asymmetric ];
   };
 }
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 2b94b6eeae50..0d19e2d77800 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -26273,7 +26273,9 @@ in {
     };
   });
 
-  magic-wormhole = callPackage ../development/python-modules/magic-wormhole {};
+  magic-wormhole = callPackage ../development/python-modules/magic-wormhole {
+    pythonPackages = self;
+  };
 
   wsgiproxy2 = buildPythonPackage rec {
     name = "WSGIProxy2-0.4.2";