From 26fb110d8163f3d6d4c19048945a28b5561b68a0 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 21 Dec 2018 00:01:13 -0500 Subject: [PATCH 1/2] pythonPackages.sh: fix tests on Python 3.7 --- pkgs/development/python-modules/sh/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/sh/default.nix b/pkgs/development/python-modules/sh/default.nix index 37388bf4690..cbfa1583a1d 100644 --- a/pkgs/development/python-modules/sh/default.nix +++ b/pkgs/development/python-modules/sh/default.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPythonPackage, fetchPypi, coverage }: +{ stdenv, buildPythonPackage, fetchPypi, python, coverage, lsof, glibcLocales }: buildPythonPackage rec { pname = "sh"; @@ -9,10 +9,15 @@ buildPythonPackage rec { sha256 = "1z2hx357xp3v4cv44xmqp7lli3frndqpyfmpbxf7n76h7s1zaaxm"; }; - checkInputs = [ coverage ]; + postPatch = '' + sed -i 's#/usr/bin/env python#${python.interpreter}#' test.py + ''; + + checkInputs = [ coverage lsof glibcLocales ]; # A test needs the HOME directory to be different from $TMPDIR. preCheck = '' + export LC_ALL="en_US.UTF-8" HOME=$(mktemp -d) ''; From d08254f7ffc7d5a0f87ca5fa5959b7bb6edfc5fb Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Fri, 21 Dec 2018 17:44:21 -0500 Subject: [PATCH 2/2] pythonPackages.sh: disable failing tests on Darwin --- .../development/python-modules/sh/default.nix | 4 ++ .../sh/disable-broken-tests-darwin.patch | 49 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 pkgs/development/python-modules/sh/disable-broken-tests-darwin.patch diff --git a/pkgs/development/python-modules/sh/default.nix b/pkgs/development/python-modules/sh/default.nix index cbfa1583a1d..964386564e4 100644 --- a/pkgs/development/python-modules/sh/default.nix +++ b/pkgs/development/python-modules/sh/default.nix @@ -9,6 +9,10 @@ buildPythonPackage rec { sha256 = "1z2hx357xp3v4cv44xmqp7lli3frndqpyfmpbxf7n76h7s1zaaxm"; }; + # Disable tests that fail on Darwin + # Some of the failures are due to Nix using GNU coreutils + patches = [ ./disable-broken-tests-darwin.patch ]; + postPatch = '' sed -i 's#/usr/bin/env python#${python.interpreter}#' test.py ''; diff --git a/pkgs/development/python-modules/sh/disable-broken-tests-darwin.patch b/pkgs/development/python-modules/sh/disable-broken-tests-darwin.patch new file mode 100644 index 00000000000..6488dd1ffea --- /dev/null +++ b/pkgs/development/python-modules/sh/disable-broken-tests-darwin.patch @@ -0,0 +1,49 @@ +From 264f2f6a04d25156bba43524a6b172d2e99c53f4 Mon Sep 17 00:00:00 2001 +From: Ben Wolsieffer +Date: Fri, 21 Dec 2018 17:39:45 -0500 +Subject: [PATCH] Disable tests that fail on OSX. + +Some of the failures are due to the use of GNU ls. +--- + test.py | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/test.py b/test.py +index 68ef40c..2f53360 100644 +--- a/test.py ++++ b/test.py +@@ -352,6 +352,7 @@ exit(3) + self.assertEqual(sed(_in="one test three", e="s/test/two/").strip(), + "one two three") + ++ @not_osx + def test_ok_code(self): + from sh import ls, ErrorReturnCode_1, ErrorReturnCode_2 + +@@ -498,6 +499,7 @@ while True: + self.assertEqual(out, match) + + ++ @not_osx + def test_environment(self): + """ tests that environments variables that we pass into sh commands + exist in the environment, and on the sh module """ +@@ -861,6 +863,7 @@ print(sys.argv[1]) + self.assertTrue(now - start > sleep_time) + + ++ @not_osx + def test_background_exception(self): + from sh import ls, ErrorReturnCode_1, ErrorReturnCode_2 + p = ls("/ofawjeofj", _bg=True) # should not raise +@@ -2036,6 +2039,7 @@ else: + self.assertEqual(p, "test") + + ++ @not_osx + def test_signal_exception(self): + from sh import SignalException_15 + +-- +2.20.0 +