diff --git a/pkgs/development/python-modules/mahotas/default.nix b/pkgs/development/python-modules/mahotas/default.nix index 818ff459985c..707ad9f3c8f6 100644 --- a/pkgs/development/python-modules/mahotas/default.nix +++ b/pkgs/development/python-modules/mahotas/default.nix @@ -1,26 +1,36 @@ -{ buildPythonPackage, fetchFromGitHub, nose, pillow, scipy, numpy, imread, lib, stdenv }: +{ buildPythonPackage, fetchFromGitHub, pillow, scipy, numpy, pytestCheckHook, imread, freeimage, lib, stdenv }: buildPythonPackage rec { pname = "mahotas"; - version = "1.4.10"; + version = "1.4.11"; src = fetchFromGitHub { owner = "luispedro"; repo = "mahotas"; rev = "v${version}"; - sha256 = "0fjiyl82wj1a6xzr9mss2y2rydl4zchl2cbdbg0jm0fcrs99q4hw"; + sha256 = "029gvy1fb855pvxvy8zwj44k4s7qpqi0161bg5wldfiprrysn1kw"; }; - # remove this as soon as https://github.com/luispedro/mahotas/issues/97 is fixed - patches = [ ./disable-impure-tests.patch ]; + propagatedBuildInputs = [ numpy imread pillow scipy freeimage ]; + checkInputs = [ pytestCheckHook ]; - propagatedBuildInputs = [ numpy imread pillow scipy ]; - checkInputs = [ nose ]; - - checkPhase= '' - python setup.py test + postPatch = '' + substituteInPlace mahotas/io/freeimage.py --replace "/opt/local/lib" "${freeimage}/lib" ''; + # tests must be run in the build directory + preCheck = '' + cd build/lib* + ''; + + # re-enable as soon as https://github.com/luispedro/mahotas/issues/97 is fixed + disabledTests = [ + "test_colors" + "test_ellipse_axes" + "test_normalize" + "test_haralick3d" + ]; + disabled = stdenv.isi686; # Failing tests meta = with lib; { diff --git a/pkgs/development/python-modules/mahotas/disable-impure-tests.patch b/pkgs/development/python-modules/mahotas/disable-impure-tests.patch deleted file mode 100644 index f19bd329e662..000000000000 --- a/pkgs/development/python-modules/mahotas/disable-impure-tests.patch +++ /dev/null @@ -1,76 +0,0 @@ -diff --git a/mahotas/tests/test_colors.py b/mahotas/tests/test_colors.py -index 8a8183b..0d34c9f 100644 ---- a/mahotas/tests/test_colors.py -+++ b/mahotas/tests/test_colors.py -@@ -2,7 +2,9 @@ import mahotas - import numpy as np - from mahotas.tests.utils import luispedro_jpg - from mahotas.colors import rgb2xyz, rgb2lab, xyz2rgb, rgb2grey, rgb2sepia -+from nose.tools import nottest - -+@nottest - def test_colors(): - f = luispedro_jpg() - lab = rgb2lab(f) -diff --git a/mahotas/tests/test_features_shape.py b/mahotas/tests/test_features_shape.py -index 462f467..2381793 100644 ---- a/mahotas/tests/test_features_shape.py -+++ b/mahotas/tests/test_features_shape.py -@@ -2,6 +2,7 @@ import mahotas.features.shape - import numpy as np - import mahotas as mh - from mahotas.features.shape import roundness, eccentricity -+from nose.tools import nottest - - def test_eccentricity(): - D = mh.disk(32, 2) -@@ -29,6 +30,7 @@ def test_zeros(): - I[8:4:12] = 1 - assert eccentricity(I) == 0 - -+@nottest - def test_ellipse_axes(): - Y,X = np.mgrid[:1024,:1024] - Y = Y/1024. -diff --git a/mahotas/tests/test_moments.py b/mahotas/tests/test_moments.py -index 686c7c3..ba3487b 100644 ---- a/mahotas/tests/test_moments.py -+++ b/mahotas/tests/test_moments.py -@@ -1,6 +1,7 @@ - import numpy as np - import mahotas as mh - from mahotas.features.moments import moments -+from nose.tools import nottest - - def _slow(A, p0, p1, cm): - c0,c1 = cm -@@ -28,7 +29,7 @@ def test_against_slow(): - yield perform, 1, 2, (0, 0), A - yield perform, 1, 0, (0, 0), A - -- -+@nottest - def test_normalize(): - A,B = np.meshgrid(np.arange(128),np.arange(128)) - for p0,p1 in [(1,1), (1,2), (2,1), (2,2)]: -diff --git a/mahotas/tests/test_texture.py b/mahotas/tests/test_texture.py -index 7e101ba..af1305d 100644 ---- a/mahotas/tests/test_texture.py -+++ b/mahotas/tests/test_texture.py -@@ -2,7 +2,7 @@ import numpy as np - from mahotas.features import texture - import mahotas as mh - import mahotas.features._texture --from nose.tools import raises -+from nose.tools import raises, nottest - - def test__cooccurence(): - cooccurence = mahotas.features._texture.cooccurence -@@ -149,6 +149,7 @@ def test_float_haralick(): - A[2,2]=12 - texture.haralick(A) - -+@nottest - def test_haralick3d(): - np.random.seed(22) - img = mahotas.stretch(255*np.random.rand(20,20,4))