Commit f0004036 authored by Gaetan Lepage's avatar Gaetan Lepage
Browse files

python3Packages.imageio: fetch patch to fix failing tests

parent 10001544
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
  buildPythonPackage,
  fetchFromGitHub,
  isPyPy,
  fetchpatch2,

  # build-system
  setuptools,
@@ -24,9 +25,10 @@
  tifffile,

  # tests
  pytestCheckHook,
  gitMinimal,
  fsspec,
  gitMinimal,
  pytestCheckHook,
  writableTmpDirAsHomeHook,
}:

let
@@ -52,6 +54,19 @@ buildPythonPackage rec {
    hash = "sha256-/nxJxZrTYX7F2grafIWwx9SyfR47ZXyaUwPHMEOdKkI=";
  };

  patches = [
    (fetchpatch2 {
      # https://github.com/imageio/imageio/issues/1139
      # https://github.com/imageio/imageio/pull/1144
      name = "fix-pyav-13-1-compat";
      url = "https://github.com/imageio/imageio/commit/eadfc5906f5c2c3731f56a582536dbc763c3a7a9.patch";
      excludes = [
        "setup.py"
      ];
      hash = "sha256-xBYdhK6XmJJuChqXOIdRVf8X6/GpWLG+21+cPVZ4bVg=";
    })
  ];

  postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
    substituteInPlace tests/test_core.py \
      --replace-fail 'ctypes.util.find_library("GL")' '"${libgl}"'
@@ -90,15 +105,16 @@ buildPythonPackage rec {
    gitMinimal
    psutil
    pytestCheckHook
    writableTmpDirAsHomeHook
  ]
  ++ fsspec.optional-dependencies.github
  ++ lib.flatten (builtins.attrValues optional-dependencies);

  pytestFlags = [ "--test-images=file://${test_images}" ];

  disabledTests = [
    # These should have had `needs_internet` mark applied but don't so far.
    # See https://github.com/imageio/imageio/pull/1142
  disabledTests = [
    "test_read_stream"
    "test_uri_reading"
    "test_trim_filter"
@@ -111,7 +127,6 @@ buildPythonPackage rec {

  preCheck = ''
    export IMAGEIO_USERDIR=$(mktemp -d)
    export HOME=$(mktemp -d)
  '';

  meta = {