diff --git a/pkgs/development/python-modules/astropy/default.nix b/pkgs/development/python-modules/astropy/default.nix index 54d41608b31c..c620aacc6bc2 100644 --- a/pkgs/development/python-modules/astropy/default.nix +++ b/pkgs/development/python-modules/astropy/default.nix @@ -1,7 +1,6 @@ { lib, fetchPypi, - fetchpatch, buildPythonPackage, pythonOlder, @@ -63,6 +62,10 @@ buildPythonPackage rec { hash = "sha256-OS/utEOyQ3zUwuBkGmXg8VunkeFI6bHl7X3n38s45GA="; }; + patches = [ + ./test_z_at_value_numpyvectorize.patch + ]; + env = lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=unused-command-line-argument"; }; diff --git a/pkgs/development/python-modules/astropy/test_z_at_value_numpyvectorize.patch b/pkgs/development/python-modules/astropy/test_z_at_value_numpyvectorize.patch new file mode 100644 index 000000000000..5ffa586d06d5 --- /dev/null +++ b/pkgs/development/python-modules/astropy/test_z_at_value_numpyvectorize.patch @@ -0,0 +1,33 @@ +From 9a7f821351f0870608b2fa3e1be31bda70707913 Mon Sep 17 00:00:00 2001 +From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> +Date: Fri, 2 May 2025 13:49:06 -0400 +Subject: [PATCH] TST: xfail test_z_at_value_numpyvectorize for numpy 2.3.dev + and later until we can fix the underlying issue + +Originally this is +https://github.com/astropy/astropy/commit/9fce0d46c5e1807d7e1030c3cb0b1a9c0a359dd9 +but the path to the file has changed since the release currently in nixpkgs. +--- + astropy/cosmology/_src/tests/funcs/test_funcs.py | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/astropy/cosmology/funcs/tests/test_funcs.py ++++ b/astropy/cosmology/funcs/tests/test_funcs.py +@@ -31,6 +31,7 @@ + ) + from astropy.cosmology._src.funcs.optimize import _z_at_scalar_value + from astropy.units import allclose ++from astropy.utils.compat import NUMPY_LT_2_3 + from astropy.utils.compat.optional_deps import HAS_SCIPY + from astropy.utils.exceptions import AstropyUserWarning + +@@ -173,6 +174,9 @@ def test_scalar_input_to_output(self): + + + @pytest.mark.skipif(not HAS_SCIPY, reason="test requires scipy") ++@pytest.mark.xfail( ++ not NUMPY_LT_2_3, reason="TODO fix: https://github.com/astropy/astropy/issues/18045" ++) + def test_z_at_value_numpyvectorize(): + """Test that numpy vectorize fails on Quantities. +