From d226f4d8560d78da88ae9ebfdc48abf443b572e0 Mon Sep 17 00:00:00 2001 From: Vinicius Monego Date: Sat, 22 May 2021 17:13:35 -0300 Subject: [PATCH 5/6] gnu: python-astropy: Enable tests. * gnu/packages/astronomy.scm (python-astropy)[arguments]: Enable tests. [phases]{setenv-astropy-system-all}: Move to after 'unpack. Rename to 'preparations'. Set HOME to /tmp. Allow xfail tests to pass. {writable-compiler}: New phase. {check}: Override phase. [native-inputs]: Add python-pytest, python-pytest-astropy, python-pytest-xdist. [inputs]: Remove wcslib. Add wcslib-7.3. --- gnu/packages/astronomy.scm | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm index 6e0fdeb969..d9785696bb 100644 --- a/gnu/packages/astronomy.scm +++ b/gnu/packages/astronomy.scm @@ -573,17 +573,31 @@ accurately in real time at any rate desired.") (base32 "09w4q64c6bykcdp8xdq5fgsdjqrcihqhqjszqjp3s5a1493kwj7d")))) (build-system python-build-system) (arguments - ;; NOTE: (Sharlatan-20210426T204315+0100): Tests require build astropy - ;; module, it needs a good review on how to enable them. - `(#:tests? #f - #:phases + `(#:phases (modify-phases %standard-phases - (add-before 'build 'setenv-astropy-system-all + (add-after 'unpack 'preparations (lambda _ - (setenv "ASTROPY_USE_SYSTEM_ALL" "1"))) - ;; Permission denied: './astropy/_compiler.c'. + ;; Use our own libraries in place of bundles. + (setenv "ASTROPY_USE_SYSTEM_ALL" "1") + ;; Some tests require a writable home. + (setenv "HOME" "/tmp") + ;; Relax xfail tests. + (substitute* "setup.cfg" + (("xfail_strict = true") "xfail_strict = false")))) + ;; This file is opened in both install and check phases. (add-before 'install 'writable-compiler - (lambda _ (make-file-writable "astropy/_compiler.c")))))) + (lambda _ (make-file-writable "astropy/_compiler.c"))) + (add-before 'check 'writable-compiler + (lambda _ (make-file-writable "astropy/_compiler.c"))) + (replace 'check + (lambda* (#:key inputs outputs tests? #:allow-other-keys) + (when tests? + (add-installed-pythonpath inputs outputs) + ;; Extensions have to be rebuilt before running the tests. + (invoke "python" "setup.py" "build_ext" "--inplace") + (invoke "python" "-m" "pytest" "--pyargs" "astropy" + ;; Skip tests that need remote data. + "-m" "not remote_data"))))))) (native-inputs `(("pkg-config" ,pkg-config) ("python-coverage" ,python-coverage) @@ -591,12 +605,17 @@ accurately in real time at any rate desired.") ("python-extension-helpers" ,python-extension-helpers) ("python-ipython" ,python-ipython) ("python-objgraph" ,python-objgraph) + ("python-pytest" ,python-pytest) + ("python-pytest-astropy" ,python-pytest-astropy) + ("python-pytest-xdist" ,python-pytest-xdist) ("python-setuptools-scm" ,python-setuptools-scm) ("python-sgp4" ,python-sgp4) ("python-skyfield" ,python-skyfield))) (inputs `(("cfitsio" ,cfitsio) - ("wcslib" ,wcslib))) + ;; Astropy 4.2.1 bundles wcslib 7.3 and that is the only version it + ;; accepts. Version 7.5 will not be validated in the build. + ("wcslib" ,wcslib-7.3))) (propagated-inputs `(("python-numpy" ,python-numpy) ("python-pyerfa" ,python-pyerfa))) -- 2.31.1