gnu: python-sunpy: Fix tests.

* gnu/packages/astronomy.scm (python-sunpy) [arguments] <test-flags>:
Skip one test introducing time bomb.
<phases>: Add 'pre-check and move set HOME here from 'check.

Change-Id: I20e3f63aa45c951bd7b093e0d02e4968aca87dc3
This commit is contained in:
Sharlatan Hellseher 2025-05-07 22:52:28 +01:00
parent cf633f1194
commit 43d6e5eefb
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -7415,18 +7415,27 @@ and @code{astropy}.")
(list
#:test-flags
#~(list "--pyargs" "sunpy"
"--numprocesses" (number->string (min 8 (parallel-job-count))))
"--numprocesses" (number->string (min 8 (parallel-job-count)))
;; Test introduces a time bomb and fails with error: ValueError:
;; interpolating from IERS_Auto using predictive values that are
;; more than 30.0 days old.
"-k" "not test_print_params")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'remove-test-files
;; Requires SpicePy wich is not packed in Guix yet and can't be
;; ignored with Pytet options for some reason.
(lambda _
;; Requires SpicePy wich is not packed in Guix yet and can't be
;; ignored with Pytet options for some reason.
(delete-file "sunpy/coordinates/tests/test_spice.py")))
(add-before 'check 'pre-check
;; It requires during sanity check as well to prevent error like:
;; PermissionError: [Errno 13] Permission denied:
;; '/homeless-shelter'
(lambda _
(setenv "HOME" "/tmp")))
(replace 'check
(lambda* (#:key tests? test-flags #:allow-other-keys)
(when tests?
(setenv "HOME" "/tmp")
(with-directory-excursion "/tmp"
(apply invoke "pytest" "-vv" test-flags))))))))
(native-inputs