python.pkgs.flask-restful: fix tests

Fixes #43001.
This commit is contained in:
Robert Schütz 2018-07-05 18:58:04 +02:00
parent 806e5a3882
commit a04c9e2deb

View File

@ -1,4 +1,4 @@
{ stdenv, buildPythonPackage, fetchPypi, isPy3k
{ lib, buildPythonPackage, fetchPypi, fetchpatch, isPy3k
, nose, mock, blinker
, flask, six, pytz, aniso8601, pycrypto
}:
@ -12,19 +12,27 @@ buildPythonPackage rec {
sha256 = "01rlvl2iq074ciyn4schmjip7cyplkwkysbb8f610zil06am35ap";
};
# TypeError: Only byte strings can be passed to C code
patchPhase = if isPy3k then ''
rm tests/test_crypto.py tests/test_paging.py
'' else null;
# Disable test broken with aniso > 3.0.0, can be removed when updating to a flask-restful version with commit 54979f0
preCheck = ''
substituteInPlace "./tests/test_inputs.py" --replace "test_bad_isointervals" "disabled_bad_isointervals"
'';
buildInputs = [ nose mock blinker ];
propagatedBuildInputs = [ flask six pytz aniso8601 pycrypto ];
PYTHON_EGG_CACHE = "`pwd`/.egg-cache";
patches = [
(fetchpatch {
url = https://github.com/flask-restful/flask-restful/commit/54979f0a49b2217babc53c5b65b5df10b6de8e05.patch;
sha256 = "11s6ag6l42g61ccg5jw9j1f26hwgjfa3sp890cbl5r4hy5ycpyr5";
})
(fetchpatch {
url = https://github.com/flask-restful/flask-restful/commit/f45e81a45ed03922fd225afe27006315811077e6.patch;
sha256 = "16avd369j5r08d1l23mwbba26zjwnmfqvfvnfz02am3gr5l6p3gl";
})
];
meta = with stdenv.lib; {
postPatch = lib.optionalString isPy3k ''
# TypeError: Only byte strings can be passed to C code
rm tests/test_crypto.py tests/test_paging.py
'';
checkInputs = [ nose mock blinker ];
propagatedBuildInputs = [ flask six pytz aniso8601 pycrypto ];
meta = with lib; {
homepage = "http://flask-restful.readthedocs.io/";
description = "REST API building blocks for Flask";
license = licenses.bsd3;