diff --git a/astropy-pr10433-wcslib73-tests.patch b/astropy-pr10433-wcslib73-tests.patch new file mode 100644 index 0000000..479f209 --- /dev/null +++ b/astropy-pr10433-wcslib73-tests.patch @@ -0,0 +1,123 @@ +From 89b9db3e1336fafcbd3a6ab851b7278e24c5d77d Mon Sep 17 00:00:00 2001 +From: Mihai Cara +Date: Wed, 3 Jun 2020 01:39:28 -0400 +Subject: [PATCH] deal with updated WCSLIB to v7.3 (partial pr#10433) + +--- + CHANGES.rst | 5 ++++- + astropy/wcs/setup_package.py | 2 +- + astropy/wcs/tests/test_wcs.py | 18 ++++++++++++++++-- + astropy/wcs/tests/test_wcsprm.py | 17 +++++++++++++---- + 4 files changed, 34 insertions(+), 8 deletions(-) + +diff --git a/astropy/wcs/setup_package.py b/astropy/wcs/setup_package.py +index c0fc32376..c7f0b09ab 100644 +--- a/astropy/wcs/setup_package.py ++++ b/astropy/wcs/setup_package.py +@@ -15,7 +15,7 @@ import numpy + from astropy_helpers.distutils_helpers import get_distutils_build_option + + WCSROOT = os.path.relpath(os.path.dirname(__file__)) +-WCSVERSION = "7.2.0" ++WCSVERSION = "7.3.0" + + + def b(s): +diff --git a/astropy/wcs/tests/test_wcs.py b/astropy/wcs/tests/test_wcs.py +index 12ccc3e10..2738bc758 100644 +--- a/astropy/wcs/tests/test_wcs.py ++++ b/astropy/wcs/tests/test_wcs.py +@@ -31,7 +31,7 @@ _WCSLIB_VER = LooseVersion(_wcs.__version__) + + + def _check_v71_dateref_warnings(w, nmax=None): +- if _WCSLIB_VER >= '7.1' and w: ++ if _WCSLIB_VER >= '7.1' and _WCSLIB_VER < '7.3' and w: + if nmax is None: + assert w + else: +@@ -375,12 +375,19 @@ def test_to_header_string(): + "CRVAL2 = 0.0 / Coordinate value at reference point ", + "LATPOLE = 90.0 / [deg] Native latitude of celestial pole ", + ) +- if _WCSLIB_VER >= '7.1': ++ ++ if _WCSLIB_VER >= '7.3': ++ hdrstr += ( ++ "MJDREF = 0.0 / [d] MJD of fiducial time ", ++ ) ++ ++ elif _WCSLIB_VER >= '7.1': + hdrstr += ( + "DATEREF = '1858-11-17' / ISO-8601 fiducial time ", + "MJDREFI = 0.0 / [d] MJD of fiducial time, integer part ", + "MJDREFF = 0.0 / [d] MJD of fiducial time, fractional part " + ) ++ + hdrstr += ("END", ) + + header_string = ''.join(hdrstr) +@@ -397,6 +404,13 @@ def test_to_header_string(): + + def test_to_fits(): + nrec = 11 if _WCSLIB_VER >= '7.1' else 8 ++ if _WCSLIB_VER < '7.1': ++ nrec = 8 ++ elif _WCSLIB_VER < '7.3': ++ nrec = 11 ++ else: ++ nrec = 9 ++ + w = wcs.WCS() + header_string = w.to_header() + wfits = w.to_fits() +diff --git a/astropy/wcs/tests/test_wcsprm.py b/astropy/wcs/tests/test_wcsprm.py +index c25ba7961..8d8a123a7 100644 +--- a/astropy/wcs/tests/test_wcsprm.py ++++ b/astropy/wcs/tests/test_wcsprm.py +@@ -435,7 +435,10 @@ def test_fix2(): + del fix_ref['obsfix'] + fix_ref['datfix'] = "Changed '31/12/99' to '1999-12-31'" + +- if LooseVersion(version) >= '7.1': ++ if LooseVersion(version) >= '7.3': ++ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix'] ++ ++ elif LooseVersion(version) >= '7.1': + fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix'] + + assert w.fix() == fix_ref +@@ -453,13 +456,17 @@ def test_fix3(): + 'datfix': "Invalid DATE-OBS format '31/12/F9'", + 'spcfix': 'No change', + 'unitfix': 'No change', +- 'celfix': 'No change'} ++ 'celfix': 'No change' ++ } ++ + version = wcs._wcs.__version__ + if LooseVersion(version) <= "5": + del fix_ref['obsfix'] + fix_ref['datfix'] = "Invalid parameter value: invalid date '31/12/F9'" + +- if LooseVersion(version) >= '7.1': ++ if LooseVersion(version) >= '7.3': ++ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix'] ++ elif LooseVersion(version) >= '7.1': + fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix'] + + assert w.fix() == fix_ref +@@ -1116,7 +1123,9 @@ def test_datebeg(): + 'unitfix': 'No change', + 'celfix': 'No change'} + +- if LooseVersion(wcs._wcs.__version__) >= '7.1': ++ if LooseVersion(wcs._wcs.__version__) >= '7.3': ++ fix_ref['datfix'] = "Set DATEREF to '1858-11-17' from MJDREF.\n" + fix_ref['datfix'] ++ elif LooseVersion(wcs._wcs.__version__) >= '7.1': + fix_ref['datfix'] = "Set DATE-REF to '1858-11-17' from MJD-REF.\n" + fix_ref['datfix'] + + assert w.fix() == fix_ref +-- +2.27.0 + diff --git a/astropy-pr10440-wcs-datfix.patch b/astropy-pr10440-wcs-datfix.patch new file mode 100644 index 0000000..75f7543 --- /dev/null +++ b/astropy-pr10440-wcs-datfix.patch @@ -0,0 +1,24 @@ +From 4ddb4e94c67a4d8712fc656bcd9882b8f7e2b2f4 Mon Sep 17 00:00:00 2001 +From: Mihai Cara +Date: Wed, 3 Jun 2020 16:31:22 -0400 +Subject: [PATCH] Do not issue datfix warning when MJDREF has default value + +--- + CHANGES.rst | 2 ++ (removed for rebase) + astropy/wcs/wcs.py | 3 +++ + 2 files changed, 5 insertions(+) + +diff --git a/astropy/wcs/wcs.py b/astropy/wcs/wcs.py +index 7f5f79bbc95..aa3a4d77951 100644 +--- a/astropy/wcs/wcs.py ++++ b/astropy/wcs/wcs.py +@@ -681,6 +681,9 @@ def fix(self, translate_units='', naxis=None): + fixes = self.wcs.fix(translate_units, naxis) + for key, val in fixes.items(): + if val != "No change": ++ if (key == 'datfix' and '1858-11-17' in val and ++ not np.count_nonzero(self.wcs.mjdref)): ++ continue + warnings.warn( + ("'{0}' made the change '{1}'."). + format(key, val), diff --git a/astropy-pr10545-remove-newline-3d_cd_hdr.patch b/astropy-pr10545-remove-newline-3d_cd_hdr.patch new file mode 100644 index 0000000..5199ff9 --- /dev/null +++ b/astropy-pr10545-remove-newline-3d_cd_hdr.patch @@ -0,0 +1,54 @@ +From e87d4647f2b152b33ef4c22edc2daf16b1dbc1bc Mon Sep 17 00:00:00 2001 +From: Mihai Cara +Date: Wed, 8 Jul 2020 13:14:01 -0400 +Subject: [PATCH] Remove newline characters from header file 3d_cd.hdr + +--- + astropy/wcs/tests/data/3d_cd.hdr | 17 +---------------- + astropy/wcs/tests/test_wcs.py | 9 ++++----- + 2 files changed, 5 insertions(+), 21 deletions(-) + +diff --git a/astropy/wcs/tests/data/3d_cd.hdr b/astropy/wcs/tests/data/3d_cd.hdr +index be4ce2f1f88..8791e9d35e8 100644 +--- a/astropy/wcs/tests/data/3d_cd.hdr ++++ b/astropy/wcs/tests/data/3d_cd.hdr +@@ -1,16 +1 @@ +-CD1_2 = -3.72E-05 +-CD1_3 = 0 +-CD1_1 = -4.12E-05 +-CUNIT3 = 'nm ' +-CUNIT2 = 'deg ' +-CTYPE1 = 'RA---TAN' +-NAXIS = 3 +-CTYPE3 = 'AWAV ' +-CD2_1 = -3.72E-05 +-CTYPE2 = 'DEC--TAN' +-CD2_3 = 0 +-CD2_2 = 4.12E-05 +-CUNIT1 = 'deg ' +-CD3_1 = 0 +-CD3_2 = 0 +-CD3_3 = 0.2 +\ No newline at end of file ++CD1_2 = -3.72E-05 CD1_3 = 0 CD1_1 = -4.12E-05 CUNIT3 = 'nm ' CUNIT2 = 'deg ' CTYPE1 = 'RA---TAN' NAXIS = 3 CTYPE3 = 'AWAV ' CD2_1 = -3.72E-05 CTYPE2 = 'DEC--TAN' CD2_3 = 0 CD2_2 = 4.12E-05 CUNIT1 = 'deg ' CD3_1 = 0 CD3_2 = 0 CD3_3 = 0.2 +\ No newline at end of file +diff --git a/astropy/wcs/tests/test_wcs.py b/astropy/wcs/tests/test_wcs.py +index 509d3e916a3..cd180952458 100644 +--- a/astropy/wcs/tests/test_wcs.py ++++ b/astropy/wcs/tests/test_wcs.py +@@ -823,11 +823,10 @@ def test_printwcs(capsys): + captured = capsys.readouterr() + assert 'WCS Keywords' in captured.out + h = get_pkg_data_contents('data/3d_cd.hdr', encoding='binary') +- with pytest.warns(AstropyUserWarning): +- w = wcs.WCS(h) +- w.printwcs() +- captured = capsys.readouterr() +- assert 'WCS Keywords' in captured.out ++ w = wcs.WCS(h) ++ w.printwcs() ++ captured = capsys.readouterr() ++ assert 'WCS Keywords' in captured.out + + + def test_invalid_spherical(): diff --git a/python-astropy.changes b/python-astropy.changes index 4ab10e1..d164df8 100644 --- a/python-astropy.changes +++ b/python-astropy.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Fri Jul 17 11:42:19 UTC 2020 - Benjamin Greiner + +- actually detect unit test failures with sys.exit(astropy.tests()) +- do not fail on DeprecationWarnings +- support updated system lib wcslib 7.3 with + astropy-pr10433-wcslib73-tests.patch gh#astropy/astropy#10433 + astropy-pr10440-wcs-datfix.patch gh#astropy/astropy#10440 +- clean up blank lines after pytest report and prevent possible + failure of tests depending on test order + astropy-pr10545-remove-newline-3d_cd_hdr.patch + gh#astropy/astropy#10545 + ------------------------------------------------------------------- Thu Jul 9 23:14:09 UTC 2020 - Benjamin Greiner diff --git a/python-astropy.spec b/python-astropy.spec index 5e45f84..fef1d37 100644 --- a/python-astropy.spec +++ b/python-astropy.spec @@ -34,6 +34,12 @@ Summary: Community-developed python astronomy tools License: BSD-3-Clause URL: https://astropy.org Source: https://files.pythonhosted.org/packages/source/a/astropy/astropy-%{version}.tar.gz +# PATCH-FIX-UPSTREAM astropy-pr10433-wcslib73-tests.patch gh#astropy/astropy#10433 -- allow system wcslib 7.3 +Patch0: astropy-pr10433-wcslib73-tests.patch +# PATCH-FIX-UPSTREAM astropy-pr10440-wcs-datfix.patch gh#astropy/astropy#10440 -- allow system wcslib 7.3 +Patch1: astropy-pr10440-wcs-datfix.patch +# PATCH-FIX-UPSTREAM astropy-pr10545-remove-newline-3d_cd_hdr.patch gh#astropy/astropy#10545 -- clean up newlines after pytest output +Patch2: astropy-pr10545-remove-newline-3d_cd_hdr.patch # Mark wcs headers as false positives for devel-file-in-non-devel-package # These are used by the python files so they must be available. Source100: python-astropy-rpmlintrc @@ -111,6 +117,10 @@ managing them. %if !%{with test} %prep %setup -q -n astropy-%{version} +%autopatch -p1 + +# Disable test failure on DeprecationWarnings +sed -i "/enable_deprecations_as_exceptions(/,/)/ d" astropy/conftest.py # Make sure bundled libs are not used rm -rf cextern/expat @@ -158,7 +168,7 @@ $python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/ %endif # http://docs.astropy.org/en/latest/development/testguide.html#running-tests # running pytest directly would require building the extensions inplace -%python_exec -B -c "import astropy; astropy.test(args=\"-v %{?skip_pytest}\")" +%python_exec -B -c "import astropy, sys; sys.exit(astropy.test(args=\"-v %{?skip_pytest}\"))" %endif %if !%{with test}