anchor.diff:  
     disabled = isPy3k; # see https://github.com/thumbor/thumbor/issues/1004
   
  -  src = fetchPypi {
  -    inherit pname version;
  -    sha256 = "1icfnzwzi5lvnh576n7v3r819jaw15ph9ja2w3fwg5z9qs40xvl8";
  +  # Tests aren't included in PyPI tarball so use GitHub instead
  +  src = fetchFromGitHub {
  +    owner = pname;
  +    repo = pname;
  +    rev = version;
  +    sha256 = "1ys5ymwbvgh2ir85g9nyrzzf8vgi16j6pzzi53b0rgjx0kwlmnxg";
     };
   
     postPatch = ''
       substituteInPlace "setup.py" \
         --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 = [
       tornado
  
positive.code: { buildPythonPackage, tornado, pycrypto, pycurl, pytz
  , pillow, derpconf, python_magic, pexif, libthumbor, opencv, webcolors
  , piexif, futures, statsd, thumborPexif, fetchPypi, isPy3k, lib
  }:
  
  buildPythonPackage rec {
  
negative.code:     pillow
      derpconf
      python_magic
      libthumbor
      opencv3
      webcolors
      piexif
      statsd
      pkgs.exiftool
      pkgs.libjpeg
      pkgs.ffmpeg
      pkgs.gifsicle
    ] ++ lib.optionals (!isPy3k) [ futures thumborPexif ];
  
    # Remove the source tree before running nosetests because otherwise nosetests
    # uses that instead of the installed package. Is there some other way to
    # achieve this?
    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; {
      description = "A smart imaging service";
  