about summary refs log tree commit diff
path: root/pkgs/development/python-modules/astropy
diff options
context:
space:
mode:
authorSébastien Maret <sebastien.maret@icloud.com>2019-07-23 11:50:25 +0200
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-07-27 11:58:50 +0200
commitee6c007fccc0e8ed1768dcf317bdd33aa4deea5b (patch)
treea19549e8cf56d6c951725c1858a8473bb2f7b467 /pkgs/development/python-modules/astropy
parent2dabd051a7a910d94bc2a9819dcf0719802056dc (diff)
pythonPackages.astropy: add checkPhase
Diffstat (limited to 'pkgs/development/python-modules/astropy')
-rw-r--r--pkgs/development/python-modules/astropy/default.nix27
1 files changed, 23 insertions, 4 deletions
diff --git a/pkgs/development/python-modules/astropy/default.nix b/pkgs/development/python-modules/astropy/default.nix
index 06716929575ab..f46ca274f2e1f 100644
--- a/pkgs/development/python-modules/astropy/default.nix
+++ b/pkgs/development/python-modules/astropy/default.nix
@@ -3,7 +3,10 @@
 , buildPythonPackage
 , isPy3k
 , numpy
-, pytest }:
+, pytest
+, pytest-astropy
+, astropy-helpers
+}:
 
 buildPythonPackage rec {
   pname = "astropy";
@@ -11,14 +14,30 @@ buildPythonPackage rec {
 
   disabled = !isPy3k; # according to setup.py
 
-  doCheck = false; #Some tests are failing. More importantly setup.py hangs on completion. Needs fixing with a proper shellhook.
-
   src = fetchPypi {
     inherit pname version;
     sha256 = "706c0457789c78285e5464a5a336f5f0b058d646d60f4e5f5ba1f7d5bf424b28";
   };
 
-  propagatedBuildInputs = [ pytest numpy ]; # yes it really has pytest in install_requires
+  nativeBuildInputs = [ astropy-helpers ];
+
+  propagatedBuildInputs = [ numpy pytest ]; # yes it really has pytest in install_requires
+
+  checkInputs = [ pytest pytest-astropy ];
+
+  # Disable automatic update of the astropy-helper module
+  postPatch = ''
+    substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
+  '';
+
+  # Tests must be run from the build directory.  astropy/samp tests
+  # require a network connection, so we ignore them. For some reason
+  # pytest --ignore does not work, so we delete the tests instead.
+  checkPhase = ''
+    cd build/lib.*
+    rm -f astropy/samp/tests/*
+    pytest
+  '';
 
   meta = {
     description = "Astronomy/Astrophysics library for Python";