diff options
author | Sharlatan Hellseher <sharlatanus@gmail.com> | 2025-06-29 21:20:40 +0100 |
---|---|---|
committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2025-07-06 18:44:04 +0100 |
commit | 0fb7ae747f91fad88fd1e4a0f465b388bc56da8b (patch) | |
tree | dc5660a739df490567e5d8401aa0b8668e1e4232 /gnu/packages/python-science.scm | |
parent | d7c53159131988191a4d571a258fdaaa09b4c184 (diff) |
gnu: python-scikit-image: Fix tests.
In some cases there could be an issue to test compiled Cython library
which is not available in local checkout working directory. This change
is inspired by the way NixOS packages scikit-image and run tests from
the output with "--pyargs" option where compiled library is available.
See: <https://github.com/NixOS/nixpkgs/blob/nixos-25.05/\
pkgs/development/python-modules/scikit-image/default.nix>.
* gnu/packages/python-science.scm (python-scikit-image) [arguments]
<test-flags>: Run tests from {#$output}, add "--pyargs" option and skip
one more problematic test.
<phases>: Use default 'check; add 'pre-check and post-check.
Change-Id: I60f58359f59b371854f4963e2f7c65c9221a0924
Diffstat (limited to 'gnu/packages/python-science.scm')
-rw-r--r-- | gnu/packages/python-science.scm | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 5df9fbfdd2..ddf625a9e2 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -2256,28 +2256,41 @@ logic, also known as grey logic.") (origin (method git-fetch) (uri (git-reference - (url "https://github.com/scikit-image/scikit-image") - (commit (string-append "v" version)))) + (url "https://github.com/scikit-image/scikit-image") + (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 (base32 "1bc8i57sjk44vd9k1ilr6fpvfq1zbq9yfi22lz22k26mzrlisym3")))) (build-system pyproject-build-system) (arguments (list - ;; Disable flaky test - #:test-flags #~(list "-k" "not test_ellipse_parameter_stability") + #:test-flags + ;; To make sure we test compiled and installed module. + #~(list (string-append #$output "/lib/python" + #$(version-major+minor (package-version python)) + "/site-packages") + "--pyargs" "skimage" + ;; Disable flaky test + "-k" (string-join + (list "not test_ellipse_parameter_stability" + ;; ValueError: Cannot call len() on object with unknown chunk size. + "test_thresholds_dask_compatibility[threshold_triangle-41-43]") + " and not ")) #:phases #~(modify-phases %standard-phases (add-before 'build 'change-home-dir (lambda _ ;; Change from /homeless-shelter to /tmp for write permission. (setenv "HOME" "/tmp"))) - (replace 'check - (lambda* (#:key tests? test-flags #:allow-other-keys) - (when tests? - (with-directory-excursion "/tmp" - (apply invoke "pytest" "-v" "--doctest-modules" - (append test-flags (list #$output)))))))))) + (add-before 'check 'pre-check + (lambda _ + ;; To prevent loading tests twise. + ;; 16277 passed, 240 skipped, 4 deselected + (delete-file-recursively "skimage"))) + (add-before 'check 'post-check + (lambda _ + (for-each delete-file-recursively + (find-files #$output "__pycache__" #:directories? #t))))))) ;; See requirements/ for the list of build and run time requirements. ;; NOTE: scikit-image has an optional dependency on python-pooch, however ;; propagating it would enable many more tests that require online data. |