pythonPackages.thumbor: run tests

This commit is contained in:
Jaakko Luttinen 2018-10-27 16:17:52 +03:00 committed by Maximilian Bosch
parent cfaf696a7b
commit 336f11c3b1
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E

View File

@ -1,6 +1,8 @@
{ buildPythonPackage, tornado, pycrypto, pycurl, pytz { buildPythonPackage, python, tornado, pycrypto, pycurl, pytz
, pillow, derpconf, python_magic, pexif, libthumbor, opencv, webcolors , pillow, derpconf, python_magic, libthumbor, webcolors
, piexif, futures, statsd, thumborPexif, fetchPypi, isPy3k, lib , piexif, futures, statsd, thumborPexif, fetchFromGitHub, isPy3k, lib
, mock, raven, nose, yanc, remotecv, pyssim, cairosvg1, preggy, opencv3
, pkgs, coreutils
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -9,16 +11,38 @@ buildPythonPackage rec {
disabled = isPy3k; # see https://github.com/thumbor/thumbor/issues/1004 disabled = isPy3k; # see https://github.com/thumbor/thumbor/issues/1004
src = fetchPypi { # Tests aren't included in PyPI tarball so use GitHub instead
inherit pname version; src = fetchFromGitHub {
sha256 = "1icfnzwzi5lvnh576n7v3r819jaw15ph9ja2w3fwg5z9qs40xvl8"; owner = pname;
repo = pname;
rev = version;
sha256 = "1ys5ymwbvgh2ir85g9nyrzzf8vgi16j6pzzi53b0rgjx0kwlmnxg";
}; };
postPatch = '' postPatch = ''
substituteInPlace "setup.py" \ substituteInPlace "setup.py" \
--replace '"argparse",' "" ${lib.optionalString isPy3k ''--replace '"futures",' ""''} --replace '"argparse",' "" ${lib.optionalString isPy3k ''--replace '"futures",' ""''}
substituteInPlace "tests/test_utils.py" \
--replace "/bin/ls" "${coreutils}/bin/ls"
substituteInPlace "tests/detectors/test_face_detector.py" \
--replace "./thumbor" "$out/lib/${python.libPrefix}/site-packages/thumbor"
substituteInPlace "tests/detectors/test_glasses_detector.py" \
--replace "./thumbor" "$out/lib/${python.libPrefix}/site-packages/thumbor"
''; '';
checkInputs = [
nose
pyssim
preggy
mock
yanc
remotecv
cairosvg1
raven
pkgs.redis
pkgs.glibcLocales
];
propagatedBuildInputs = [ propagatedBuildInputs = [
tornado tornado
pycrypto pycrypto
@ -27,18 +51,26 @@ buildPythonPackage rec {
pillow pillow
derpconf derpconf
python_magic python_magic
pexif
libthumbor libthumbor
opencv opencv3
webcolors webcolors
piexif piexif
statsd statsd
pkgs.exiftool
pkgs.libjpeg
pkgs.ffmpeg
pkgs.gifsicle
] ++ lib.optionals (!isPy3k) [ futures thumborPexif ]; ] ++ lib.optionals (!isPy3k) [ futures thumborPexif ];
# disabled due to too many impure tests and issues with native modules in # Remove the source tree before running nosetests because otherwise nosetests
# the pure testing environment. See https://github.com/NixOS/nixpkgs/pull/37147 # uses that instead of the installed package. Is there some other way to
# for further reference. # achieve this?
doCheck = false; checkPhase = ''
redis-server --port 6668 --requirepass hey_you &
rm -r thumbor
export LC_ALL="en_US.UTF-8"
nosetests -v --with-yanc -s tests/
'';
meta = with lib; { meta = with lib; {
description = "A smart imaging service"; description = "A smart imaging service";