gnu: python-astropy: Improve packages style.

* gnu/packages/astronomy.scm (python-astropy): Adjust package style.
[arguments] <#:phases>: Simplify 'preparations, move step setting up
HOME env to 'prepare-test-environment phase.
Add 'prepare-test-environment phase, consolidating all pre test
procedures.
{check}: Add option to run test in parallel to accelerate them. Remove
from disabled list tests which were passed successfully.

Change-Id: I306ab60b6e155c81035de9584fbd9d06a6381045
This commit is contained in:
Sharlatan Hellseher 2024-01-27 13:08:21 +00:00
parent e8c1c87c34
commit 38b6670c7a
No known key found for this signature in database
GPG Key ID: 76D727BFF62CD2B5
1 changed files with 46 additions and 40 deletions

View File

@ -1499,46 +1499,52 @@ accurately in real time at any rate desired.")
(for-each delete-file-recursively '("expat" "wcslib"))))))) (for-each delete-file-recursively '("expat" "wcslib")))))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:phases
(add-after 'unpack 'preparations #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'preparations
;; Use our own libraries in place of bundles. (lambda _
(setenv "ASTROPY_USE_SYSTEM_ALL" "1") ;; Use our own libraries in place of bundles.
;; Some tests require a writable home. (setenv "ASTROPY_USE_SYSTEM_ALL" "1")
(setenv "HOME" "/tmp") ;; Relax xfail tests.
;; Relax xfail tests. (substitute* "pyproject.toml"
(substitute* "pyproject.toml" (("xfail_strict = true") "xfail_strict = false"))
(("xfail_strict = true") "xfail_strict = false")) ;; Replace reference to external ply.
;; Replace reference to external ply. (substitute* "astropy/utils/parsing.py"
(substitute* "astropy/utils/parsing.py" (("astropy.extern.ply") "ply"))
(("astropy.extern.ply") "ply")) ;; Replace reference to external configobj.
;; Replace reference to external configobj. (substitute* "astropy/config/configuration.py"
(with-directory-excursion "astropy/config" (("from astropy.extern.configobj ") ""))))
(substitute* "configuration.py" ;; This file is opened in both install and check phases.
(("from astropy.extern.configobj ") ""))))) (add-before 'install 'writable-compiler
;; This file is opened in both install and check phases. (lambda _
(add-before 'install 'writable-compiler (make-file-writable "astropy/_compiler.c")))
(lambda _ (make-file-writable "astropy/_compiler.c"))) (add-before 'check 'prepare-test-environment
(add-before 'check 'writable-compiler (lambda _
(lambda _ (make-file-writable "astropy/_compiler.c"))) ;; Some tests require a writable home.
(replace 'check (setenv "HOME" "/tmp")
(lambda* (#:key inputs outputs tests? #:allow-other-keys) (make-file-writable "astropy/_compiler.c")
(when tests? ;; Extensions have to be rebuilt before running the tests.
(add-installed-pythonpath inputs outputs) (invoke "python" "setup.py" "build_ext" "--inplace"
;; Extensions have to be rebuilt before running the tests. "-j" (number->string (parallel-job-count)))))
(invoke "python" "setup.py" "build_ext" "--inplace") ;; TODO: The swap to pyproject-build-system introduced all tests
(invoke "python" "-m" "pytest" "--pyargs" "astropy" ;; failed due to pytest could not load conftest.py, find out how
;; Skip tests that need remote data. ;; to resolve it and migrate completely to pyproject-build-system.
"-k" (string-append (replace 'check
"not remote_data" (lambda* (#:key tests? #:allow-other-keys)
;; XXX: Check why this tests failing. (when tests?
" and not test_ignore_sigint" (invoke "python" "-m" "pytest" "--pyargs" "astropy"
" and not test_parquet_filter" ;; with -n : 133.00s
;; See https://github.com/astropy/astropy/issues/15537 ;; without -n : 326.14s
" and not test_pvstar" "-n" (number->string (parallel-job-count))
;; E ModuleNotFoundError: No module named 'wofz' "-k" (string-append
" and not test_pickle_functional")))))))) ;; Skip tests that need remote data.
"not remote_data"
;; E astropy.samp.errors.SAMPProxyError:
;; <SAMPProxyError 1: 'Timeout expired!'>
" and not test_main"
;; E ModuleNotFoundError: No module named 'wofz'
" and not test_pickle_functional"))))))))
(native-inputs (native-inputs
(list pkg-config (list pkg-config
python-colorlog python-colorlog