python3Packages.imageio: fix tests

This commit is contained in:
Martin Weinelt 2022-03-06 18:00:32 +01:00
parent 7e491988f3
commit 8fde457ce9
2 changed files with 37 additions and 15 deletions

View file

@ -1,14 +1,17 @@
{ lib
, stdenv
, buildPythonPackage
, isPy27
, fetchPypi
, fetchpatch
, substituteAll
, imageio-ffmpeg
, numpy
, pillow
, psutil
, pytestCheckHook
, tifffile
, fsspec
, libGL
}:
buildPythonPackage rec {
@ -21,6 +24,13 @@ buildPythonPackage rec {
inherit pname version;
};
patches = [
(substituteAll {
src = ./libgl-path.patch;
libgl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}";
})
];
propagatedBuildInputs = [
imageio-ffmpeg
numpy
@ -28,34 +38,33 @@ buildPythonPackage rec {
];
checkInputs = [
fsspec
psutil
pytestCheckHook
tifffile
];
preCheck = ''
export IMAGEIO_USERDIR="$TMP"
export IMAGEIO_NO_INTERNET="true"
export HOME="$(mktemp -d)"
'';
disabledTests = [
# tries to pull remote resources, even with IMAGEIO_NO_INTERNET
"test_png_remote"
# needs git history
"test_mvolread_out_of_bytes"
"test_imiter"
"test_memory_size"
"test_legacy_write_empty"
pytestFlagsArray = [
"-m 'not needs_internet'"
];
preCheck = ''
export IMAGEIO_USERDIR="$TMP"
export HOME=$TMPDIR
'';
disabledTestPaths = [
# tries to fetch fixtures over the network
"tests/test_freeimage.py"
"tests/test_pillow.py"
"tests/test_spe.py"
"tests/test_swf.py"
];
meta = with lib; {
description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
homepage = "http://imageio.github.io/";
license = licenses.bsd2;
maintainers = with maintainers; [ ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/tests/test_core.py b/tests/test_core.py
index 2cdbb3a..032974c 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -129,7 +129,7 @@ def test_findlib2():
open(os.path.join(fi_dir, "notalib.test.so"), "wb")
# Loading libs
- gllib = ctypes.util.find_library("GL")
+ gllib = "@libgl@"
core.load_lib([gllib], [])
# Fail
raises(ValueError, core.load_lib, [], []) # Nothing given